szaszm commented on a change in pull request #897:
URL: https://github.com/apache/nifi-minifi-cpp/pull/897#discussion_r484405587
##########
File path: libminifi/include/utils/ByteArrayCallback.h
##########
@@ -65,7 +66,7 @@ class ByteInputCallBack : public InputStreamCallback {
}
virtual char *getBuffer(size_t pos) {
- return ptr + pos;
+ return reinterpret_cast<char*>(&vec[0]) + pos;
Review comment:
Please use `vec.data()` to avoid out-of-bounds indexing when `vec` is
empty, or index with pos.
```suggestion
return &vec[pos];
```
or
```suggestion
return vec.data() + pos;
```
----------------------------------------------------------------
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]