szaszm commented on a change in pull request #731: MINIFICPP-1096 fix
BackTrace, OOB indexing, tests, appveyor reporting
URL: https://github.com/apache/nifi-minifi-cpp/pull/731#discussion_r386437366
##########
File path: extensions/http-curl/client/HTTPStream.cpp
##########
@@ -90,13 +95,17 @@ inline std::vector<uint8_t> HttpStream::readBuffer(const
T& t) {
}
int HttpStream::readData(std::vector<uint8_t> &buf, int buflen) {
- if ((int) buf.capacity() < buflen) {
+ if (buflen < 0) {
+ throw minifi::Exception{ExceptionType::GENERAL_EXCEPTION, "negative
buflen"};
+ }
+
+ if (buf.size() < static_cast<size_t>(buflen)) {
Review comment:
I've missed this and `HTTPStream::writeData`, but I've found no more
occurences of missing cast.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services