]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Removed MAX_DIST2 which is incompatible with zlib when compiled with INFLATE_STRICT...
authorNathan Moinvaziri <nathan@nathanm.com>
Thu, 2 Jan 2020 15:59:52 +0000 (07:59 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 7 Feb 2020 16:48:05 +0000 (17:48 +0100)
deflate_medium.c

index f694facdd6f14ba6568430edfadbcdf8ef4b346f..4c975ea55a81f0f311f5f9852e9abb0514eaa6f5 100644 (file)
@@ -20,8 +20,6 @@ struct match {
     unsigned int orgstart;
 };
 
-#define MAX_DIST2  ((1 << MAX_WBITS) - MIN_LOOKAHEAD)
-
 static int tr_tally_dist(deflate_state *s, int distance, int length) {
     return zng_tr_tally(s, distance, length);
 }
@@ -162,7 +160,7 @@ static void fizzle_matches(deflate_state *s, struct match *current, struct match
     n = *next;
 
     /* step one: try to move the "next" match to the left as much as possible */
-    limit = next->strstart > MAX_DIST2 ? next->strstart - MAX_DIST2 : 0;
+    limit = next->strstart > MAX_DIST(s) ? next->strstart - MAX_DIST(s) : 0;
 
     match = s->window + n.match_start - 1;
     orig = s->window + n.strstart - 1;
@@ -249,7 +247,7 @@ ZLIB_INTERNAL block_state deflate_medium(deflate_state *s, int flush) {
              * At this point we have always match_length < MIN_MATCH
              */
 
-            if (hash_head != 0 && s->strstart - hash_head <= MAX_DIST2) {
+            if (hash_head != 0 && s->strstart - hash_head <= MAX_DIST(s)) {
                 /* To simplify the code, we prevent matches with the string
                  * of window index 0 (in particular we have to avoid a match
                  * of the string with itself at the start of the input file).
@@ -281,7 +279,7 @@ ZLIB_INTERNAL block_state deflate_medium(deflate_state *s, int flush) {
             /* Find the longest match, discarding those <= prev_length.
              * At this point we have always match_length < MIN_MATCH
              */
-            if (hash_head != 0 && s->strstart - hash_head <= MAX_DIST2) {
+            if (hash_head != 0 && s->strstart - hash_head <= MAX_DIST(s)) {
                 /* To simplify the code, we prevent matches with the string
                  * of window index 0 (in particular we have to avoid a match
                  * of the string with itself at the start of the input file).