aboutsummaryrefslogtreecommitdiff
path: root/gzlib.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2025-04-09 23:35:16 -0700
committerMark Adler <git@madler.net>2025-12-06 17:39:44 -0800
commit95278e4ef9de87294dea0c94184bd8fe4316c3a9 (patch)
treecea18c4601b460ef7ed5e63910e9cd2ae7c518ce /gzlib.c
parent1ab1026a20282383d9cd2282f81461655bea4028 (diff)
downloadzlib-95278e4ef9de87294dea0c94184bd8fe4316c3a9.tar.gz
zlib-95278e4ef9de87294dea0c94184bd8fe4316c3a9.tar.bz2
zlib-95278e4ef9de87294dea0c94184bd8fe4316c3a9.zip
Improve the discrimination between trailing garbage and bad gzip.
This proceeds to try to decode whatever follows the last gzip member, and concludes that it is acceptable trailing garbage only if it results in a data error without decompressing any data. This commit also reduces the probability of a false-positive gzip header detection.
Diffstat (limited to 'gzlib.c')
-rw-r--r--gzlib.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gzlib.c b/gzlib.c
index 4c1aa83a..79a7e978 100644
--- a/gzlib.c
+++ b/gzlib.c
@@ -72,6 +72,7 @@ local void gz_reset(gz_statep state) {
72 state->eof = 0; /* not at end of file */ 72 state->eof = 0; /* not at end of file */
73 state->past = 0; /* have not read past end yet */ 73 state->past = 0; /* have not read past end yet */
74 state->how = LOOK; /* look for gzip header */ 74 state->how = LOOK; /* look for gzip header */
75 state->junk = -1; /* mark first member */
75 } 76 }
76 else /* for writing ... */ 77 else /* for writing ... */
77 state->reset = 0; /* no deflateReset pending */ 78 state->reset = 0; /* no deflateReset pending */