From: Hans Kristian Rosbach Date: Sun, 11 Aug 2019 16:55:14 +0000 (+0200) Subject: Move scan_start check, based on Cloudflare commit X-Git-Tag: 1.9.9-b1~406 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cdbc9002f37e57fffe55d2f0dd1173e75985ea51;p=thirdparty%2Fzlib-ng.git Move scan_start check, based on Cloudflare commit 5f1bd2b72e5966aa8a4f942e6e8050a050161cf9 --- diff --git a/match_p.h b/match_p.h index 776d6cec..363c7a3c 100644 --- a/match_p.h +++ b/match_p.h @@ -432,7 +432,8 @@ static inline unsigned longest_match(deflate_state *const s, IPos cur_match) { int cont = 1; do { match = window + cur_match; - if (likely(memcmp(match+best_len-1, &scan_end, sizeof(scan_end)) != 0)) { + if (likely(memcmp(match+best_len-1, &scan_end, sizeof(scan_end)) != 0 + || memcmp(match, &scan_start, sizeof(scan_start)) != 0)) { if ((cur_match = prev[cur_match & wmask]) > limit && --chain_length != 0) { continue; @@ -446,9 +447,6 @@ static inline unsigned longest_match(deflate_state *const s, IPos cur_match) { if (!cont) break; - if (memcmp(match, &scan_start, sizeof(scan_start)) != 0) - continue; - /* It is not necessary to compare scan[2] and match[2] since they are * always equal when the other bytes match, given that the hash keys * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at