|
|
44948f |
This patch was cherry-picked from upstream commit:
|
|
|
44948f |
5c44459c3b28a9bd3283aaceab7c615f8020c531
|
|
|
44948f |
|
|
|
44948f |
https://github.com/madler/zlib/commit/5c44459c3b28a9bd3283aaceab7c615f8020c531
|
|
|
44948f |
|
|
|
44948f |
From 4dfe77b6a94596d5b52a8048d9571cd1bf7f4532 Mon Sep 17 00:00:00 2001
|
|
|
44948f |
From: Mark Adler <madler@alumni.caltech.edu>
|
|
|
44948f |
Date: Tue, 17 Apr 2018 22:09:22 -0700
|
|
|
44948f |
Subject: [PATCH] Fix a bug that can crash deflate on some input when using
|
|
|
44948f |
Z_FIXED.
|
|
|
44948f |
|
|
|
44948f |
This bug was reported by Danilo Ramos of Eideticom, Inc. It has
|
|
|
44948f |
lain in wait 13 years before being found! The bug was introduced
|
|
|
44948f |
in zlib 1.2.2.2, with the addition of the Z_FIXED option. That
|
|
|
44948f |
option forces the use of fixed Huffman codes. For rare inputs with
|
|
|
44948f |
a large number of distant matches, the pending buffer into which
|
|
|
44948f |
the compressed data is written can overwrite the distance symbol
|
|
|
44948f |
table which it overlays. That results in corrupted output due to
|
|
|
44948f |
invalid distances, and can result in out-of-bound accesses,
|
|
|
44948f |
crashing the application.
|
|
|
44948f |
|
|
|
44948f |
The fix here combines the distance buffer and literal/length
|
|
|
44948f |
buffers into a single symbol buffer. Now three bytes of pending
|
|
|
44948f |
buffer space are opened up for each literal or length/distance
|
|
|
44948f |
pair consumed, instead of the previous two bytes. This assures
|
|
|
44948f |
that the pending buffer cannot overwrite the symbol table, since
|
|
|
44948f |
the maximum fixed code compressed length/distance is 31 bits, and
|
|
|
44948f |
since there are four bytes of pending space for every three bytes
|
|
|
44948f |
of symbol space.
|
|
|
44948f |
---
|
|
|
44948f |
deflate.c | 74 ++++++++++++++++++++++++++++++++++++++++---------------
|
|
|
44948f |
deflate.h | 29 ++++++++++------------
|
|
|
44948f |
trees.c | 50 +++++++++++--------------------------
|
|
|
44948f |
3 files changed, 81 insertions(+), 72 deletions(-)
|
|
|
44948f |
|
|
|
44948f |
diff --git a/deflate.c b/deflate.c
|
|
|
44948f |
index 9e4c2cb..9a9a106 100644
|
|
|
44948f |
--- a/deflate.c
|
|
|
44948f |
+++ b/deflate.c
|
|
|
44948f |
@@ -225,11 +225,6 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|
|
44948f |
int wrap = 1;
|
|
|
44948f |
static const char my_version[] = ZLIB_VERSION;
|
|
|
44948f |
|
|
|
44948f |
- ushf *overlay;
|
|
|
44948f |
- /* We overlay pending_buf and d_buf+l_buf. This works since the average
|
|
|
44948f |
- * output size for (length,distance) codes is <= 24 bits.
|
|
|
44948f |
- */
|
|
|
44948f |
-
|
|
|
44948f |
if (version == Z_NULL || version[0] != my_version[0] ||
|
|
|
44948f |
stream_size != sizeof(z_stream)) {
|
|
|
44948f |
return Z_VERSION_ERROR;
|
|
|
44948f |
@@ -298,9 +293,47 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|
|
44948f |
|
|
|
44948f |
s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
|
|
|
44948f |
|
|
|
44948f |
- overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
|
|
|
44948f |
- s->pending_buf = (uchf *) overlay;
|
|
|
44948f |
- s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
|
|
|
44948f |
+ /* We overlay pending_buf and sym_buf. This works since the average size
|
|
|
44948f |
+ * for length/distance pairs over any compressed block is assured to be 31
|
|
|
44948f |
+ * bits or less.
|
|
|
44948f |
+ *
|
|
|
44948f |
+ * Analysis: The longest fixed codes are a length code of 8 bits plus 5
|
|
|
44948f |
+ * extra bits, for lengths 131 to 257. The longest fixed distance codes are
|
|
|
44948f |
+ * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest
|
|
|
44948f |
+ * possible fixed-codes length/distance pair is then 31 bits total.
|
|
|
44948f |
+ *
|
|
|
44948f |
+ * sym_buf starts one-fourth of the way into pending_buf. So there are
|
|
|
44948f |
+ * three bytes in sym_buf for every four bytes in pending_buf. Each symbol
|
|
|
44948f |
+ * in sym_buf is three bytes -- two for the distance and one for the
|
|
|
44948f |
+ * literal/length. As each symbol is consumed, the pointer to the next
|
|
|
44948f |
+ * sym_buf value to read moves forward three bytes. From that symbol, up to
|
|
|
44948f |
+ * 31 bits are written to pending_buf. The closest the written pending_buf
|
|
|
44948f |
+ * bits gets to the next sym_buf symbol to read is just before the last
|
|
|
44948f |
+ * code is written. At that time, 31*(n-2) bits have been written, just
|
|
|
44948f |
+ * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at
|
|
|
44948f |
+ * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1
|
|
|
44948f |
+ * symbols are written.) The closest the writing gets to what is unread is
|
|
|
44948f |
+ * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and
|
|
|
44948f |
+ * can range from 128 to 32768.
|
|
|
44948f |
+ *
|
|
|
44948f |
+ * Therefore, at a minimum, there are 142 bits of space between what is
|
|
|
44948f |
+ * written and what is read in the overlain buffers, so the symbols cannot
|
|
|
44948f |
+ * be overwritten by the compressed data. That space is actually 139 bits,
|
|
|
44948f |
+ * due to the three-bit fixed-code block header.
|
|
|
44948f |
+ *
|
|
|
44948f |
+ * That covers the case where either Z_FIXED is specified, forcing fixed
|
|
|
44948f |
+ * codes, or when the use of fixed codes is chosen, because that choice
|
|
|
44948f |
+ * results in a smaller compressed block than dynamic codes. That latter
|
|
|
44948f |
+ * condition then assures that the above analysis also covers all dynamic
|
|
|
44948f |
+ * blocks. A dynamic-code block will only be chosen to be emitted if it has
|
|
|
44948f |
+ * fewer bits than a fixed-code block would for the same set of symbols.
|
|
|
44948f |
+ * Therefore its average symbol length is assured to be less than 31. So
|
|
|
44948f |
+ * the compressed data for a dynamic block also cannot overwrite the
|
|
|
44948f |
+ * symbols from which it is being constructed.
|
|
|
44948f |
+ */
|
|
|
44948f |
+
|
|
|
44948f |
+ s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
|
|
|
44948f |
+ s->pending_buf_size = (ulg)s->lit_bufsize * 4;
|
|
|
44948f |
|
|
|
44948f |
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
|
|
|
44948f |
s->pending_buf == Z_NULL) {
|
|
|
44948f |
@@ -309,8 +342,12 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|
|
44948f |
deflateEnd (strm);
|
|
|
44948f |
return Z_MEM_ERROR;
|
|
|
44948f |
}
|
|
|
44948f |
- s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
|
|
|
44948f |
- s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
|
|
|
44948f |
+ s->sym_buf = s->pending_buf + s->lit_bufsize;
|
|
|
44948f |
+ s->sym_end = (s->lit_bufsize - 1) * 3;
|
|
|
44948f |
+ /* We avoid equality with lit_bufsize*3 because of wraparound at 64K
|
|
|
44948f |
+ * on 16 bit machines and because stored blocks are restricted to
|
|
|
44948f |
+ * 64K-1 bytes.
|
|
|
44948f |
+ */
|
|
|
44948f |
|
|
|
44948f |
s->level = level;
|
|
|
44948f |
s->strategy = strategy;
|
|
|
44948f |
@@ -471,7 +508,7 @@ int ZEXPORT deflatePrime (strm, bits, value)
|
|
|
44948f |
|
|
|
44948f |
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
|
|
|
44948f |
s = strm->state;
|
|
|
44948f |
- if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
|
|
|
44948f |
+ if (s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
|
|
|
44948f |
return Z_BUF_ERROR;
|
|
|
44948f |
do {
|
|
|
44948f |
put = Buf_size - s->bi_valid;
|
|
|
44948f |
@@ -1018,7 +1055,6 @@ int ZEXPORT deflateCopy (dest, source)
|
|
|
44948f |
#else
|
|
|
44948f |
deflate_state *ds;
|
|
|
44948f |
deflate_state *ss;
|
|
|
44948f |
- ushf *overlay;
|
|
|
44948f |
|
|
|
44948f |
|
|
|
44948f |
if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
|
|
|
44948f |
@@ -1038,8 +1074,7 @@ int ZEXPORT deflateCopy (dest, source)
|
|
|
44948f |
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
|
|
|
44948f |
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
|
|
|
44948f |
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
|
|
|
44948f |
- overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
|
|
|
44948f |
- ds->pending_buf = (uchf *) overlay;
|
|
|
44948f |
+ ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
|
|
|
44948f |
|
|
|
44948f |
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
|
|
|
44948f |
ds->pending_buf == Z_NULL) {
|
|
|
44948f |
@@ -1053,8 +1088,7 @@ int ZEXPORT deflateCopy (dest, source)
|
|
|
44948f |
zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
|
|
|
44948f |
|
|
|
44948f |
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
|
|
|
44948f |
- ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
|
|
|
44948f |
- ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
|
|
|
44948f |
+ ds->sym_buf = ds->pending_buf + ds->lit_bufsize;
|
|
|
44948f |
|
|
|
44948f |
ds->l_desc.dyn_tree = ds->dyn_ltree;
|
|
|
44948f |
ds->d_desc.dyn_tree = ds->dyn_dtree;
|
|
|
44948f |
@@ -1714,7 +1748,7 @@ local block_state deflate_fast(s, flush)
|
|
|
44948f |
FLUSH_BLOCK(s, 1);
|
|
|
44948f |
return finish_done;
|
|
|
44948f |
}
|
|
|
44948f |
- if (s->last_lit)
|
|
|
44948f |
+ if (s->sym_next)
|
|
|
44948f |
FLUSH_BLOCK(s, 0);
|
|
|
44948f |
return block_done;
|
|
|
44948f |
}
|
|
|
44948f |
@@ -1845,7 +1879,7 @@ local block_state deflate_slow(s, flush)
|
|
|
44948f |
FLUSH_BLOCK(s, 1);
|
|
|
44948f |
return finish_done;
|
|
|
44948f |
}
|
|
|
44948f |
- if (s->last_lit)
|
|
|
44948f |
+ if (s->sym_next)
|
|
|
44948f |
FLUSH_BLOCK(s, 0);
|
|
|
44948f |
return block_done;
|
|
|
44948f |
}
|
|
|
44948f |
@@ -1920,7 +1954,7 @@ local block_state deflate_rle(s, flush)
|
|
|
44948f |
FLUSH_BLOCK(s, 1);
|
|
|
44948f |
return finish_done;
|
|
|
44948f |
}
|
|
|
44948f |
- if (s->last_lit)
|
|
|
44948f |
+ if (s->sym_next)
|
|
|
44948f |
FLUSH_BLOCK(s, 0);
|
|
|
44948f |
return block_done;
|
|
|
44948f |
}
|
|
|
44948f |
@@ -1959,7 +1993,7 @@ local block_state deflate_huff(s, flush)
|
|
|
44948f |
FLUSH_BLOCK(s, 1);
|
|
|
44948f |
return finish_done;
|
|
|
44948f |
}
|
|
|
44948f |
- if (s->last_lit)
|
|
|
44948f |
+ if (s->sym_next)
|
|
|
44948f |
FLUSH_BLOCK(s, 0);
|
|
|
44948f |
return block_done;
|
|
|
44948f |
}
|
|
|
44948f |
diff --git a/deflate.h b/deflate.h
|
|
|
44948f |
index fbac44d..8961edd 100644
|
|
|
44948f |
--- a/deflate.h
|
|
|
44948f |
+++ b/deflate.h
|
|
|
44948f |
@@ -214,7 +214,7 @@ typedef struct internal_state {
|
|
|
44948f |
/* Depth of each subtree used as tie breaker for trees of equal frequency
|
|
|
44948f |
*/
|
|
|
44948f |
|
|
|
44948f |
- uchf *l_buf; /* buffer for literals or lengths */
|
|
|
44948f |
+ uchf *sym_buf; /* buffer for distances and literals/lengths */
|
|
|
44948f |
|
|
|
44948f |
uInt lit_bufsize;
|
|
|
44948f |
/* Size of match buffer for literals/lengths. There are 4 reasons for
|
|
|
44948f |
@@ -236,13 +236,8 @@ typedef struct internal_state {
|
|
|
44948f |
* - I can't count above 4
|
|
|
44948f |
*/
|
|
|
44948f |
|
|
|
44948f |
- uInt last_lit; /* running index in l_buf */
|
|
|
44948f |
-
|
|
|
44948f |
- ushf *d_buf;
|
|
|
44948f |
- /* Buffer for distances. To simplify the code, d_buf and l_buf have
|
|
|
44948f |
- * the same number of elements. To use different lengths, an extra flag
|
|
|
44948f |
- * array would be necessary.
|
|
|
44948f |
- */
|
|
|
44948f |
+ uInt sym_next; /* running index in sym_buf */
|
|
|
44948f |
+ uInt sym_end; /* symbol table full when sym_next reaches this */
|
|
|
44948f |
|
|
|
44948f |
ulg opt_len; /* bit length of current block with optimal trees */
|
|
|
44948f |
ulg static_len; /* bit length of current block with static trees */
|
|
|
44948f |
@@ -322,20 +317,22 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
|
|
|
44948f |
|
|
|
44948f |
# define _tr_tally_lit(s, c, flush) \
|
|
|
44948f |
{ uch cc = (c); \
|
|
|
44948f |
- s->d_buf[s->last_lit] = 0; \
|
|
|
44948f |
- s->l_buf[s->last_lit++] = cc; \
|
|
|
44948f |
+ s->sym_buf[s->sym_next++] = 0; \
|
|
|
44948f |
+ s->sym_buf[s->sym_next++] = 0; \
|
|
|
44948f |
+ s->sym_buf[s->sym_next++] = cc; \
|
|
|
44948f |
s->dyn_ltree[cc].Freq++; \
|
|
|
44948f |
- flush = (s->last_lit == s->lit_bufsize-1); \
|
|
|
44948f |
+ flush = (s->sym_next == s->sym_end); \
|
|
|
44948f |
}
|
|
|
44948f |
# define _tr_tally_dist(s, distance, length, flush) \
|
|
|
44948f |
- { uch len = (length); \
|
|
|
44948f |
- ush dist = (distance); \
|
|
|
44948f |
- s->d_buf[s->last_lit] = dist; \
|
|
|
44948f |
- s->l_buf[s->last_lit++] = len; \
|
|
|
44948f |
+ { uch len = (uch)(length); \
|
|
|
44948f |
+ ush dist = (ush)(distance); \
|
|
|
44948f |
+ s->sym_buf[s->sym_next++] = dist; \
|
|
|
44948f |
+ s->sym_buf[s->sym_next++] = dist >> 8; \
|
|
|
44948f |
+ s->sym_buf[s->sym_next++] = len; \
|
|
|
44948f |
dist--; \
|
|
|
44948f |
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
|
|
|
44948f |
s->dyn_dtree[d_code(dist)].Freq++; \
|
|
|
44948f |
- flush = (s->last_lit == s->lit_bufsize-1); \
|
|
|
44948f |
+ flush = (s->sym_next == s->sym_end); \
|
|
|
44948f |
}
|
|
|
44948f |
#else
|
|
|
44948f |
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
|
|
|
44948f |
diff --git a/trees.c b/trees.c
|
|
|
44948f |
index 8c32b21..133de01 100644
|
|
|
44948f |
--- a/trees.c
|
|
|
44948f |
+++ b/trees.c
|
|
|
44948f |
@@ -418,7 +418,7 @@ local void init_block(s)
|
|
|
44948f |
|
|
|
44948f |
s->dyn_ltree[END_BLOCK].Freq = 1;
|
|
|
44948f |
s->opt_len = s->static_len = 0L;
|
|
|
44948f |
- s->last_lit = s->matches = 0;
|
|
|
44948f |
+ s->sym_next = s->matches = 0;
|
|
|
44948f |
}
|
|
|
44948f |
|
|
|
44948f |
#define SMALLEST 1
|
|
|
44948f |
@@ -943,7 +943,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
|
|
44948f |
|
|
|
44948f |
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
|
|
44948f |
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
|
|
44948f |
- s->last_lit));
|
|
|
44948f |
+ s->sym_next / 3));
|
|
|
44948f |
|
|
|
44948f |
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
|
|
|
44948f |
|
|
|
44948f |
@@ -1010,8 +1010,9 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
|
|
|
44948f |
unsigned dist; /* distance of matched string */
|
|
|
44948f |
unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
|
|
|
44948f |
{
|
|
|
44948f |
- s->d_buf[s->last_lit] = (ush)dist;
|
|
|
44948f |
- s->l_buf[s->last_lit++] = (uch)lc;
|
|
|
44948f |
+ s->sym_buf[s->sym_next++] = dist;
|
|
|
44948f |
+ s->sym_buf[s->sym_next++] = dist >> 8;
|
|
|
44948f |
+ s->sym_buf[s->sym_next++] = lc;
|
|
|
44948f |
if (dist == 0) {
|
|
|
44948f |
/* lc is the unmatched char */
|
|
|
44948f |
s->dyn_ltree[lc].Freq++;
|
|
|
44948f |
@@ -1026,30 +1027,7 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
|
|
|
44948f |
s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
|
|
|
44948f |
s->dyn_dtree[d_code(dist)].Freq++;
|
|
|
44948f |
}
|
|
|
44948f |
-
|
|
|
44948f |
-#ifdef TRUNCATE_BLOCK
|
|
|
44948f |
- /* Try to guess if it is profitable to stop the current block here */
|
|
|
44948f |
- if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
|
|
|
44948f |
- /* Compute an upper bound for the compressed length */
|
|
|
44948f |
- ulg out_length = (ulg)s->last_lit*8L;
|
|
|
44948f |
- ulg in_length = (ulg)((long)s->strstart - s->block_start);
|
|
|
44948f |
- int dcode;
|
|
|
44948f |
- for (dcode = 0; dcode < D_CODES; dcode++) {
|
|
|
44948f |
- out_length += (ulg)s->dyn_dtree[dcode].Freq *
|
|
|
44948f |
- (5L+extra_dbits[dcode]);
|
|
|
44948f |
- }
|
|
|
44948f |
- out_length >>= 3;
|
|
|
44948f |
- Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
|
|
|
44948f |
- s->last_lit, in_length, out_length,
|
|
|
44948f |
- 100L - out_length*100L/in_length));
|
|
|
44948f |
- if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
|
|
|
44948f |
- }
|
|
|
44948f |
-#endif
|
|
|
44948f |
- return (s->last_lit == s->lit_bufsize-1);
|
|
|
44948f |
- /* We avoid equality with lit_bufsize because of wraparound at 64K
|
|
|
44948f |
- * on 16 bit machines and because stored blocks are restricted to
|
|
|
44948f |
- * 64K-1 bytes.
|
|
|
44948f |
- */
|
|
|
44948f |
+ return (s->sym_next == s->sym_end);
|
|
|
44948f |
}
|
|
|
44948f |
|
|
|
44948f |
/* ===========================================================================
|
|
|
44948f |
@@ -1062,13 +1040,14 @@ local void compress_block(s, ltree, dtree)
|
|
|
44948f |
{
|
|
|
44948f |
unsigned dist; /* distance of matched string */
|
|
|
44948f |
int lc; /* match length or unmatched char (if dist == 0) */
|
|
|
44948f |
- unsigned lx = 0; /* running index in l_buf */
|
|
|
44948f |
+ unsigned sx = 0; /* running index in sym_buf */
|
|
|
44948f |
unsigned code; /* the code to send */
|
|
|
44948f |
int extra; /* number of extra bits to send */
|
|
|
44948f |
|
|
|
44948f |
- if (s->last_lit != 0) do {
|
|
|
44948f |
- dist = s->d_buf[lx];
|
|
|
44948f |
- lc = s->l_buf[lx++];
|
|
|
44948f |
+ if (s->sym_next != 0) do {
|
|
|
44948f |
+ dist = s->sym_buf[sx++] & 0xff;
|
|
|
44948f |
+ dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
|
|
|
44948f |
+ lc = s->sym_buf[sx++];
|
|
|
44948f |
if (dist == 0) {
|
|
|
44948f |
send_code(s, lc, ltree); /* send a literal byte */
|
|
|
44948f |
Tracecv(isgraph(lc), (stderr," '%c' ", lc));
|
|
|
44948f |
@@ -1093,11 +1072,10 @@ local void compress_block(s, ltree, dtree)
|
|
|
44948f |
}
|
|
|
44948f |
} /* literal or match pair ? */
|
|
|
44948f |
|
|
|
44948f |
- /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
|
|
|
44948f |
- Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
|
|
|
44948f |
- "pendingBuf overflow");
|
|
|
44948f |
+ /* Check that the overlay between pending_buf and sym_buf is ok: */
|
|
|
44948f |
+ Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
|
|
|
44948f |
|
|
|
44948f |
- } while (lx < s->last_lit);
|
|
|
44948f |
+ } while (sx < s->sym_next);
|
|
|
44948f |
|
|
|
44948f |
send_code(s, END_BLOCK, ltree);
|
|
|
44948f |
}
|
|
|
44948f |
--
|
|
|
44948f |
2.34.1
|
|
|
44948f |
|