mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 20:09:25 +02:00
* Fix issue ID #36822. Total was being misused in check
git-svn-id: trunk@49421 -
(cherry picked from commit affefb6ce0
)
This commit is contained in:
parent
55d25eea07
commit
c17dfa0041
@ -88,6 +88,7 @@ type gz_stream = record
|
||||
transparent : boolean; { true if input file is not a .gz file }
|
||||
mode : char; { 'w' or 'r' }
|
||||
startpos : longint; { start of compressed data in file (header skipped) }
|
||||
total_out : cardinal; { Total read, over blocks }
|
||||
end;
|
||||
|
||||
type gz_streamp = ^gz_stream;
|
||||
@ -563,7 +564,7 @@ var
|
||||
{$endif}
|
||||
|
||||
begin
|
||||
|
||||
filelen := 0;
|
||||
s := gz_streamp(f);
|
||||
start := Pbyte(buf); { starting point for crc computation }
|
||||
|
||||
@ -643,7 +644,7 @@ begin
|
||||
filecrc := getLong (s);
|
||||
filelen := getLong (s);
|
||||
|
||||
if (s^.crc <> filecrc) or (s^.stream.total_out <> filelen)
|
||||
if (s^.crc <> filecrc) or (s^.stream.total_out-s^.total_out <> filelen)
|
||||
then s^.z_err := Z_DATA_ERROR
|
||||
else begin
|
||||
{ Check for concatenated .gz files: }
|
||||
@ -651,6 +652,7 @@ begin
|
||||
if (s^.z_err = Z_OK) then begin
|
||||
total_in := s^.stream.total_in;
|
||||
total_out := s^.stream.total_out;
|
||||
s^.total_out:=total_out;
|
||||
|
||||
inflateReset (s^.stream);
|
||||
s^.stream.total_in := total_in;
|
||||
|
Loading…
Reference in New Issue
Block a user