Skip to content

Commit

Permalink
Patch miniz.h to guard against infinite loop bug
Browse files Browse the repository at this point in the history
  • Loading branch information
iibclothier committed Dec 18, 2024
1 parent a91b5a3 commit 3a6f140
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/miniz.h
Original file line number Diff line number Diff line change
Expand Up @@ -4620,6 +4620,12 @@ tinfl_status tinfl_decompress(tinfl_decompressor *r,
bit_buf >>= code_len;
num_bits -= code_len;

/* assert(sym2 != 0 && counter != 0); */
if (sym2 == 0 && counter == 0)
{
TINFL_CR_RETURN_FOREVER(40, TINFL_STATUS_FAILED);
}

pOut_buf_cur[0] = (mz_uint8)counter;
if (sym2 & 256) {
pOut_buf_cur++;
Expand Down

0 comments on commit 3a6f140

Please sign in to comment.