input/Raw: Rework GetLine()

This isn't a straightforward fix, unfortunately. The existing GetLine()
implementation didn't deal well with input that's incrementally produced
where individually read chunks wouldn't end with the separator.

The prior implementation increased the buffer each time it failed to find
a separator in the current buffer, but then also ended up not searching the
full new buffer size for the terminator, doing that endlessly.

This change reworks the Raw reader to rely only on bufpos for reading
and searching purposes and skip reallocation if the buffer size if it
wasn't actually exhausted.

Closes #3957
This commit is contained in:
Arne Welzel 2024-10-02 09:27:06 +02:00 committed by Christian Kreibich
parent 4656faed6c
commit ecfa03ea1d
10 changed files with 281 additions and 26 deletions

View file

@ -0,0 +1,4 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
Input::EVENT_NEW, 24612, binary start\x00\x00\x00\x00, \x00\x00\x00\x00\x00binary done
Input::EVENT_NEW, 3, ccc, ccc
Input::EVENT_NEW, 5, final, final