瀏覽代碼

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

michael 4 年之前
父節點
當前提交
64419cbd51
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      packages/rtl/classes.pas

+ 2 - 1
packages/rtl/classes.pas

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