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_r385677942
##########
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:
Yes, the purpose is to silence the warnings about comparison between signed
and unsigned. I think I've applied this universally, but I'll double check.
----------------------------------------------------------------
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