From: Nathan Moinvaziri Date: Mon, 4 Jan 2021 05:16:40 +0000 (-0800) Subject: Fixed previous match length not reset when match start reset. X-Git-Tag: v2.0.0-RC1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=446c6974fec0d3b8a55eef7ce36a249a9eb601ea;p=thirdparty%2Fzlib-ng.git Fixed previous match length not reset when match start reset. https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24294 --- diff --git a/deflate.c b/deflate.c index f85bbb46..4f781ab2 100644 --- 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)