Explorar el Código

* Fix from henrique Werlang to fix bug ID 37672, reading too big resource stream

michael hace 5 años
padre
commit
64419cbd51
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      packages/rtl/classes.pas

+ 2 - 1
packages/rtl/classes.pas

@@ -9858,6 +9858,7 @@ begin
   FPos := 0;
   FBufLen := CharsRead;
   FEofReached:=CharsRead = 0;
+  FBuf[CharsRead] := #0;
 end;
 
 procedure TParser.CheckLoadBuffer; {$ifdef CLASSESINLINE} inline; {$endif CLASSESINLINE}
@@ -10122,7 +10123,7 @@ end;
 constructor TParser.Create(Stream: TStream);
 begin
   fStream:=Stream;
-  SetLength(fBuf,ParseBufSize);
+  SetLength(fBuf,Succ(ParseBufSize));
   fBufLen:=0;
   fPos:=0;
   fDeltaPos:=1;