From: Nathan Moinvaziri Date: Mon, 9 Sep 2024 20:32:33 +0000 (-0700) Subject: Don't use chunkunroll for inflateBack X-Git-Tag: 2.2.2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72c50edd26631c8709e91b5d4b58cf6df3beb521;p=thirdparty%2Fzlib-ng.git Don't use chunkunroll for inflateBack If the output buffer and the window buffer are the same memory allocation, we cannot make the assumptions that chunkunroll does, that it is okay to overwrite the output buffer. --- diff --git a/inffast_tpl.h b/inffast_tpl.h index 9ddd187d..c8f47867 100644 --- a/inffast_tpl.h +++ b/inffast_tpl.h @@ -249,7 +249,8 @@ void Z_INTERNAL INFLATE_FAST(PREFIX3(stream) *strm, uint32_t start) { if (op < len) { /* still need some from output */ len -= op; out = chunkcopy_safe(out, from, op, safe); - out = CHUNKUNROLL(out, &dist, &len); + if (!extra_safe) + out = CHUNKUNROLL(out, &dist, &len); out = chunkcopy_safe(out, out - dist, len, safe); } else { out = chunkcopy_safe(out, from, len, safe);