summaryrefslogtreecommitdiff
path: root/deflate.h
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2016-11-05 22:55:34 -0700
committerMark Adler <madler@alumni.caltech.edu>2016-12-04 07:39:37 -0800
commit9674807c82ae06716a678d7374362acdb6f041b5 (patch)
treed2d36ae6ece89435bfdf7b21b766866a4bbf32b4 /deflate.h
parentfc130cdd9fcb0ea4decaf003be6ddf4c5dfd5760 (diff)
downloadzlib-9674807c82ae06716a678d7374362acdb6f041b5.tar.gz
Fix bugs in creating a very large gzip header.
Diffstat (limited to 'deflate.h')
-rw-r--r--deflate.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/deflate.h b/deflate.h
index fdc0a12..fa8577e 100644
--- a/deflate.h
+++ b/deflate.h
@@ -51,13 +51,16 @@
#define Buf_size 16
/* size of bit buffer in bi_buf */
-#define INIT_STATE 42
-#define EXTRA_STATE 69
-#define NAME_STATE 73
-#define COMMENT_STATE 91
-#define HCRC_STATE 103
-#define BUSY_STATE 113
-#define FINISH_STATE 666
+#define INIT_STATE 42 /* zlib header -> BUSY_STATE */
+#ifdef GZIP
+# define GZIP_STATE 57 /* gzip header -> BUSY_STATE | EXTRA_STATE */
+#endif
+#define EXTRA_STATE 69 /* gzip extra block -> NAME_STATE */
+#define NAME_STATE 73 /* gzip file name -> COMMENT_STATE */
+#define COMMENT_STATE 91 /* gzip comment -> HCRC_STATE */
+#define HCRC_STATE 103 /* gzip header CRC -> BUSY_STATE */
+#define BUSY_STATE 113 /* deflate -> FINISH_STATE */
+#define FINISH_STATE 666 /* stream complete */
/* Stream status */
@@ -100,10 +103,10 @@ typedef struct internal_state {
Bytef *pending_buf; /* output still pending */
ulg pending_buf_size; /* size of pending_buf */
Bytef *pending_out; /* next pending byte to output to the stream */
- uInt pending; /* nb of bytes in the pending buffer */
+ ulg pending; /* nb of bytes in the pending buffer */
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
gz_headerp gzhead; /* gzip header information to write */
- uInt gzindex; /* where in extra, name, or comment */
+ ulg gzindex; /* where in extra, name, or comment */
Byte method; /* can only be DEFLATED */
int last_flush; /* value of flush param for previous deflate call */