diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2016-10-24 20:11:41 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2016-10-24 21:07:43 -0700 |
commit | b516b4bdd7c0c9f0858adfebf732089014f7b282 (patch) | |
tree | fcee291aca78e7bf475e0060e42f18a40174c947 /inflate.h | |
parent | 77fd7e56bfc75b4194145060bb1ec5256ce077c6 (diff) | |
download | zlib-b516b4bdd7c0c9f0858adfebf732089014f7b282.tar.gz zlib-b516b4bdd7c0c9f0858adfebf732089014f7b282.tar.bz2 zlib-b516b4bdd7c0c9f0858adfebf732089014f7b282.zip |
Do a more thorough check of the state for every stream call.
This verifies that the state has been initialized, that it is the
expected type of state, deflate or inflate, and that at least the
first several bytes of the internal state have not been clobbered.
Diffstat (limited to 'inflate.h')
-rw-r--r-- | inflate.h | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | /* Possible inflate modes between inflate() calls */ | 19 | /* Possible inflate modes between inflate() calls */ |
20 | typedef enum { | 20 | typedef enum { |
21 | HEAD, /* i: waiting for magic header */ | 21 | HEAD = 16180, /* i: waiting for magic header */ |
22 | FLAGS, /* i: waiting for method and flags (gzip) */ | 22 | FLAGS, /* i: waiting for method and flags (gzip) */ |
23 | TIME, /* i: waiting for modification time (gzip) */ | 23 | TIME, /* i: waiting for modification time (gzip) */ |
24 | OS, /* i: waiting for extra flags and operating system (gzip) */ | 24 | OS, /* i: waiting for extra flags and operating system (gzip) */ |
@@ -80,6 +80,7 @@ typedef enum { | |||
80 | /* State maintained between inflate() calls -- approximately 7K bytes, not | 80 | /* State maintained between inflate() calls -- approximately 7K bytes, not |
81 | including the allocated sliding window, which is up to 32K bytes. */ | 81 | including the allocated sliding window, which is up to 32K bytes. */ |
82 | struct inflate_state { | 82 | struct inflate_state { |
83 | z_streamp strm; /* pointer back to this zlib stream */ | ||
83 | inflate_mode mode; /* current inflate mode */ | 84 | inflate_mode mode; /* current inflate mode */ |
84 | int last; /* true if processing last block */ | 85 | int last; /* true if processing last block */ |
85 | 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, |