aboutsummaryrefslogtreecommitdiff
path: root/inflate.h
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2019-01-02 18:10:40 -0800
committerMark Adler <madler@alumni.caltech.edu>2019-01-02 20:40:40 -0800
commit0d36ec47f310478549c0864f215ab5c0114c49ba (patch)
tree19821ce1a005e7a5741b65e27ef6a83d8a7a565f /inflate.h
parent7c0c75e990ca5395139c148f120042048b0ce091 (diff)
downloadzlib-0d36ec47f310478549c0864f215ab5c0114c49ba.tar.gz
zlib-0d36ec47f310478549c0864f215ab5c0114c49ba.tar.bz2
zlib-0d36ec47f310478549c0864f215ab5c0114c49ba.zip
Don't bother computing check value after successful inflateSync().
inflateSync() is used to skip invalid deflate data, which means that the check value that was being computed is no longer useful. This commit turns off the check value computation, and furthermore allows a successful return if the compressed data terminated in a graceful manner. This commit also fixes a bug in the case that inflateSync() is used before a header is ever processed. In that case, there is no knowledge of a trailer, so the remainder is treated as raw.
Diffstat (limited to 'inflate.h')
-rw-r--r--inflate.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/inflate.h b/inflate.h
index a46cce6..98679fa 100644
--- a/inflate.h
+++ b/inflate.h
@@ -86,7 +86,8 @@ struct inflate_state {
86 int wrap; /* bit 0 true for zlib, bit 1 true for gzip, 86 int wrap; /* bit 0 true for zlib, bit 1 true for gzip,
87 bit 2 true to validate check value */ 87 bit 2 true to validate check value */
88 int havedict; /* true if dictionary provided */ 88 int havedict; /* true if dictionary provided */
89 int flags; /* gzip header method and flags (0 if zlib) */ 89 int flags; /* gzip header method and flags, 0 if zlib, or
90 -1 if raw or no header yet */
90 unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ 91 unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
91 unsigned long check; /* protected copy of check value */ 92 unsigned long check; /* protected copy of check value */
92 unsigned long total; /* protected copy of output count */ 93 unsigned long total; /* protected copy of output count */