From: Jim Kukunas Date: Tue, 3 Nov 2015 19:45:10 +0000 (+0100) Subject: Fix for intels zlib fork, fixes their issues #2 and #3 X-Git-Tag: 1.9.9-b1~793^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6901ac1f8f9d6d8537aa8e93ea0b382083a83162;p=thirdparty%2Fzlib-ng.git Fix for intels zlib fork, fixes their issues #2 and #3 --- diff --git a/arch/x86/deflate_quick.c b/arch/x86/deflate_quick.c index 6d727f072..f9489822c 100644 --- a/arch/x86/deflate_quick.c +++ b/arch/x86/deflate_quick.c @@ -196,7 +196,7 @@ ZLIB_INTERNAL block_state deflate_quick(deflate_state *s, int flush) { if (flush == Z_FINISH) { static_emit_end_block(s, 1); if (s->strm->avail_out == 0) - return finish_started; + return s->strm->avail_in == 0 ? finish_started : need_more; else return finish_done; } diff --git a/deflate_medium.c b/deflate_medium.c index 4e454de32..eab1d2e9b 100644 --- a/deflate_medium.c +++ b/deflate_medium.c @@ -132,6 +132,12 @@ static void fizzle_matches(deflate_state *s, struct match *current, struct match if (current->match_length <= 1) return; + if (unlikely(current->match_length > 1 + next->match_start)) + return; + + if (unlikely(current->match_length > 1 + next->strstart)) + return; + match = s->window - current->match_length + 1 + next->match_start; orig = s->window - current->match_length + 1 + next->strstart;