]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Don't use chunkunroll for inflateBack
authorNathan Moinvaziri <nathan@nathanm.com>
Mon, 9 Sep 2024 20:32:33 +0000 (13:32 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Wed, 11 Sep 2024 08:31:56 +0000 (10:31 +0200)
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.

inffast_tpl.h

index 9ddd187d84731ca741d7dcca1516d40d2d2da33e..c8f478675437ced464d706ba3461b2dff20b07c0 100644 (file)
@@ -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);