summaryrefslogtreecommitdiff
path: root/inflate.h
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2019-01-02 18:10:40 -0800
committerHans Kristian Rosbach <hk-github@circlestorm.org>2019-10-22 09:57:38 +0200
commit33ce336b82f257689e7d20cee228fa61e079b90a (patch)
tree22fb309c87c76782d97f99ffc8c33b61ef2a38df /inflate.h
parentcf5959e11915d88e1b142fef3de359a1d443bd6d (diff)
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 846fcdc..384459a 100644
--- a/inflate.h
+++ b/inflate.h
@@ -89,7 +89,8 @@ struct inflate_state {
int wrap; /* bit 0 true for zlib, bit 1 true for gzip,
bit 2 true to validate check value */
int havedict; /* true if dictionary provided */
- int flags; /* gzip header method and flags (0 if zlib) */
+ int flags; /* gzip header method and flags, 0 if zlib, or
+ -1 if raw or no header yet */
unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
unsigned long check; /* protected copy of check value */
unsigned long total; /* protected copy of output count */