]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed previous match length not reset when match start reset.
authorNathan Moinvaziri <nathan@nathanm.com>
Mon, 4 Jan 2021 05:16:40 +0000 (21:16 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Tue, 5 Jan 2021 18:43:27 +0000 (19:43 +0100)
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24294

deflate.c

index f85bbb46769fa560618d576726e82c2375572298..4f781ab22a77fc47b4e8bcc4f0642a0e9ceb7422 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -1254,7 +1254,12 @@ void Z_INTERNAL fill_window(deflate_state *s) {
          */
         if (s->strstart >= wsize+MAX_DIST(s)) {
             memcpy(s->window, s->window+wsize, (unsigned)wsize);
-            s->match_start = (s->match_start >= wsize) ? s->match_start - wsize : 0;
+            if (s->match_start >= wsize) {
+                s->match_start -= wsize;
+            } else {
+                s->match_start = 0;
+                s->prev_length = 0;
+            }
             s->strstart    -= wsize; /* we now have strstart >= MAX_DIST */
             s->block_start -= (int)wsize;
             if (s->insert > s->strstart)