From 3a6f14083fc63e7d583e9d3e0ae862950cea1277 Mon Sep 17 00:00:00 2001 From: iibclothier Date: Wed, 18 Dec 2024 08:57:45 -0600 Subject: [PATCH] Patch miniz.h to guard against infinite loop bug --- src/miniz.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/miniz.h b/src/miniz.h index 94afbd19..2f9ee3bd 100644 --- a/src/miniz.h +++ b/src/miniz.h @@ -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++;