Skip to content

Commit

Permalink
Fix "pendingBuf overflow" assert in LIT_MEM mode
Browse files Browse the repository at this point in the history
Since each element in s->d_buf is 2 bytes, the sx index should be
multiplied by 2 in the assert.

Fixes #897
  • Loading branch information
zmodem committed Dec 15, 2023
1 parent 643e17b commit 48ca09d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion trees.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,8 @@ local void compress_block(deflate_state *s, const ct_data *ltree,

/* Check for no overlay of pending_buf on needed symbols */
#ifdef LIT_MEM
Assert(s->pending < (s->lit_bufsize << 1) + sx, "pendingBuf overflow");
Assert(s->pending < (s->lit_bufsize << 1) + (sx << 1),
"pendingBuf overflow");
#else
Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
#endif
Expand Down

0 comments on commit 48ca09d

Please sign in to comment.