From 9457abb670a2c0a9f907d353bdf257593d0498a5 Mon Sep 17 00:00:00 2001 From: Nathan Moinvaziri Date: Mon, 2 Nov 2020 17:18:01 -0800 Subject: [PATCH] Fixed use-of-uninitialized value msan error when copying dist bytes with no output bytes written. --- miniz_tinfl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miniz_tinfl.c b/miniz_tinfl.c index 992de7a..749aab4 100644 --- a/miniz_tinfl.c +++ b/miniz_tinfl.c @@ -498,7 +498,7 @@ tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_nex } dist_from_out_buf_start = pOut_buf_cur - pOut_buf_start; - if ((dist > dist_from_out_buf_start) && (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)) + if ((dist > dist_from_out_buf_start || dist_from_out_buf_start == 0) && (decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)) { TINFL_CR_RETURN_FOREVER(37, TINFL_STATUS_FAILED); }