From fe6330e1d8b975ff075ab3bd85709480727e8afa Mon Sep 17 00:00:00 2001 From: jpcha2 <106297091+jpcha2@users.noreply.github.com> Date: Tue, 17 Jan 2023 12:25:12 +0300 Subject: [PATCH] Update miniz_tinfl.c Additional parameter checks --- miniz_tinfl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/miniz_tinfl.c b/miniz_tinfl.c index f7c8815..a2a2a3b 100644 --- a/miniz_tinfl.c +++ b/miniz_tinfl.c @@ -203,6 +203,10 @@ tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_nex size_t out_buf_size_mask = (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF) ? (size_t)-1 : ((pOut_buf_next - pOut_buf_start) + *pOut_buf_size) - 1, dist_from_out_buf_start; /* Ensure the output buffer's size is a power of 2, unless the output buffer is large enough to hold the entire output file (in which case it doesn't matter). */ + if ((!pOut_buf_start) || (!pOut_buf_next) || (!pIn_buf_size) || (!pOut_buf_size)) + { + return TINFL_STATUS_BAD_PARAM; + } if (((out_buf_size_mask + 1) & out_buf_size_mask) || (pOut_buf_next < pOut_buf_start)) { *pIn_buf_size = *pOut_buf_size = 0;