You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/02/27 17:26:24 UTC

[GitHub] [nifi-minifi-cpp] bakaid commented on a change in pull request #731: MINIFICPP-1096 fix BackTrace, OOB indexing, tests, appveyor reporting

bakaid 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_r385227484
 
 

 ##########
 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:
   If this cast is the way to silence a warning I am OK with it, but then we should do the same in `HttpStream::writeData` (and all the other `readData`/`writeData` functions modified here).

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services