* Fix issue ID #0039024, potential wrong write

git-svn-id: trunk@49518 -
This commit is contained in:
michael 2021-06-20 08:06:08 +00:00
parent 492a0ffcac
commit 15f25da1fa

View File

@ -972,7 +972,7 @@ end;
procedure TDeflater.Compress; procedure TDeflater.Compress;
Var Var
Buf : PByte; Buf : PByte;
I,Count,NewCount : integer; I,Count : integer;
C : TCompressionStream; C : TCompressionStream;
BytesNow : Int64; BytesNow : Int64;
NextMark : Int64; NextMark : Int64;
@ -996,9 +996,8 @@ begin
Count:=FInFile.Read(Buf^,FBufferSize); Count:=FInFile.Read(Buf^,FBufferSize);
For I:=0 to Count-1 do For I:=0 to Count-1 do
UpdC32(Buf[i]); UpdC32(Buf[i]);
NewCount:=Count; // Writebuffer will loop
while (NewCount>0) do C.WriteBuffer(Buf^,Count);
NewCount:=NewCount-C.Write(Buf^,NewCount);
inc(BytesNow,Count); inc(BytesNow,Count);
if BytesNow>NextMark Then if BytesNow>NextMark Then
begin begin