diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2016-11-05 22:55:34 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2016-12-04 07:39:37 -0800 |
commit | 9674807c82ae06716a678d7374362acdb6f041b5 (patch) | |
tree | d2d36ae6ece89435bfdf7b21b766866a4bbf32b4 /deflate.h | |
parent | fc130cdd9fcb0ea4decaf003be6ddf4c5dfd5760 (diff) | |
download | zlib-9674807c82ae06716a678d7374362acdb6f041b5.tar.gz zlib-9674807c82ae06716a678d7374362acdb6f041b5.tar.bz2 zlib-9674807c82ae06716a678d7374362acdb6f041b5.zip |
Fix bugs in creating a very large gzip header.
Diffstat (limited to 'deflate.h')
-rw-r--r-- | deflate.h | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -51,13 +51,16 @@ | |||
51 | #define Buf_size 16 | 51 | #define Buf_size 16 |
52 | /* size of bit buffer in bi_buf */ | 52 | /* size of bit buffer in bi_buf */ |
53 | 53 | ||
54 | #define INIT_STATE 42 | 54 | #define INIT_STATE 42 /* zlib header -> BUSY_STATE */ |
55 | #define EXTRA_STATE 69 | 55 | #ifdef GZIP |
56 | #define NAME_STATE 73 | 56 | # define GZIP_STATE 57 /* gzip header -> BUSY_STATE | EXTRA_STATE */ |
57 | #define COMMENT_STATE 91 | 57 | #endif |
58 | #define HCRC_STATE 103 | 58 | #define EXTRA_STATE 69 /* gzip extra block -> NAME_STATE */ |
59 | #define BUSY_STATE 113 | 59 | #define NAME_STATE 73 /* gzip file name -> COMMENT_STATE */ |
60 | #define FINISH_STATE 666 | 60 | #define COMMENT_STATE 91 /* gzip comment -> HCRC_STATE */ |
61 | #define HCRC_STATE 103 /* gzip header CRC -> BUSY_STATE */ | ||
62 | #define BUSY_STATE 113 /* deflate -> FINISH_STATE */ | ||
63 | #define FINISH_STATE 666 /* stream complete */ | ||
61 | /* Stream status */ | 64 | /* Stream status */ |
62 | 65 | ||
63 | 66 | ||
@@ -100,10 +103,10 @@ typedef struct internal_state { | |||
100 | Bytef *pending_buf; /* output still pending */ | 103 | Bytef *pending_buf; /* output still pending */ |
101 | ulg pending_buf_size; /* size of pending_buf */ | 104 | ulg pending_buf_size; /* size of pending_buf */ |
102 | Bytef *pending_out; /* next pending byte to output to the stream */ | 105 | Bytef *pending_out; /* next pending byte to output to the stream */ |
103 | uInt pending; /* nb of bytes in the pending buffer */ | 106 | ulg pending; /* nb of bytes in the pending buffer */ |
104 | int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ | 107 | int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ |
105 | gz_headerp gzhead; /* gzip header information to write */ | 108 | gz_headerp gzhead; /* gzip header information to write */ |
106 | uInt gzindex; /* where in extra, name, or comment */ | 109 | ulg gzindex; /* where in extra, name, or comment */ |
107 | Byte method; /* can only be DEFLATED */ | 110 | Byte method; /* can only be DEFLATED */ |
108 | int last_flush; /* value of flush param for previous deflate call */ | 111 | int last_flush; /* value of flush param for previous deflate call */ |
109 | 112 | ||