ensure \0 after moving data to start of the buffer #98
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DO NOT MERGE
This is some debugging done for #97 that might help ..
These ugly code hacks solve the case where
newlen
is larger thanlen
and the buffer data is moved to the start of the buffer (L350 - L355 in the patch) and there is no \0 seen afterwards. The IOC would always report%s
mismatch. In other words, I do not see the mismatch on%s
occurring anymore as a consequence of executing this part of the code.But ..
In the attached file you can find two cases of failure and one success case ; in all cases the
newlen+offs
==cap
and thereforememset()
is not called.In the hexdump output one can see 16 more bytes that do not belong to the buffer (cap = 64). I thought byte 40 would be
\0
in the successful case ; but that is not the case. Also looking at the lines withbuffer after:
the next character that causes the%s
to fail is not the one at hexdump offset 40. This makes me think that there is another issue elsewhere, outside theStreamBuffer::replace()
.stream-errors.txt
Of course I might be totally wrong 'cause I do not know any parts of the source code. I'll be looking into it later on .. unless you beat me to it ;)
EDIT:
Ups, just noticed that the text file was not made with master branch of the streamdevice code so the line numbers in there are off. I did run the master branch code, too, and saw the issues I was seeing with the "older" code I was running earlier. Will run all new debug on the master branch code from now on