Repository navigation
Minimal change to fix reading 1-past-end of buffer - #4
John-LittleBearLabs wants to merge 1 commit into
Conversation
Correcting boundary check.
|
Here are some affected CIDs, both correct (post-fix) and incorrect (pre-fix) sorted together (the error is always at the end, of course). Note: this is just what happened on my machine. When you're accessing invalid, possibly uninitialized, memory, your results may very well vary. |
|
Thanks for the fix! |
BTW I don't think valgrind would've caught it if I stored the bytes in a std::string, since that structure keeps a valid, readable, byte with value zero after the stored bytes. What might be a better test, not relying on such particularlities, have your own past-the-end byte, and re-run the check with different values in that byte to see if you can get the outcome to change. |
Correcting boundary check.