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