[fpc-devel] TStreamReader (streamex unit) issue

Andrea Mauri andrea.mauri.75 at gmail.com
Thu Apr 8 10:36:47 CEST 2021

Dear all,
TStreamReader.ReadLine seems to fail under specific circumstances.
I created a test to easily reproduce the problem.
The test makes use of a TStream that behaves in a weird, but formally
correct way. I created it based on a real experience with the StdIn that I
was able to reproduce thanks to pre-existing logging.
I suggest you use the test on Windows otherwise I'm not sure you'll be able
to reproduce the problem.

I believe the bug can be fixed by updating VPByte right after FillBuffer is

      VPByte := @FBuffer[FBufferPosition]; //bugfix
      VPosition := FBufferPosition;

Tested with Lazarus 2.0.10 FPC 3.2.0 on Win64

Posted on lazarus forum at:

Is it a bug or am I missing something?

Kind regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20210408/302a2a27/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_project.zip
Type: application/x-zip-compressed
Size: 131485 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20210408/302a2a27/attachment-0001.bin>

More information about the fpc-devel mailing list