From affefb6ce01dd202065c8281350aa53cf02d2cda Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 31 May 2021 20:07:18 +0000 Subject: [PATCH] * Fix issue ID #36822. Total was being misused in check git-svn-id: trunk@49421 - --- packages/paszlib/src/gzio.pas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/paszlib/src/gzio.pas b/packages/paszlib/src/gzio.pas index 7c839f5fbd..4e298e9b2d 100644 --- a/packages/paszlib/src/gzio.pas +++ b/packages/paszlib/src/gzio.pas @@ -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;