Subprocedure CheckBuffer in procedure ReadLn (unit QLexLib) doesn't take into
account SizeOf(Char) when checking buffer size and allocating buffer. Existing
procedure should be changed to
procedure CheckBuffer;
begin
repeat
//we need to take into account size of char - we are increasing
//position in stream by SizeOf(char) and not by a byte
if (i * SizeOf(Char)) >= (BufSize - SizeOf(Char)) then
//(- SizeOf(Char) is needed if BufSize is odd number and
//GetMem works in chunks of 1 byte
begin
BufSize := max (BufSize * 2, 256);
ReallocMem (Buf, BufSize);
end;
until (i * SizeOf(Char)) < (BufSize - SizeOf(Char));
end;
Original issue reported on code.google.com by greg....@gmail.com on 27 Jul 2010 at 10:48
Original issue reported on code.google.com by
greg....@gmail.com
on 27 Jul 2010 at 10:48