Browse Source

* Fix from Sven Barth for bug ID 36676 : TParser reads too many bytes in certain cases

michael 5 years ago
parent
commit
20646eb432
1 changed files with 4 additions and 1 deletions
  1. 4 1
      packages/rtl/classes.pas

+ 4 - 1
packages/rtl/classes.pas

@@ -9652,8 +9652,11 @@ var
 begin
 begin
   CharsRead:=0;
   CharsRead:=0;
   for I:=0 to ParseBufSize-1 do
   for I:=0 to ParseBufSize-1 do
+  begin
     if FStream.ReadData(FBuf[i])<>2 then
     if FStream.ReadData(FBuf[i])<>2 then
-       Inc(CharsRead);
+      Break;
+    Inc(CharsRead);
+  end;
   Inc(FDeltaPos, CharsRead);
   Inc(FDeltaPos, CharsRead);
   FPos := 0;
   FPos := 0;
   FBufLen := CharsRead;
   FBufLen := CharsRead;