]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix for intels zlib fork, fixes their issues #2 and #3
authorJim Kukunas <james.t.kukunas@linux.intel.com>
Tue, 3 Nov 2015 19:45:10 +0000 (20:45 +0100)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Tue, 3 Nov 2015 19:46:36 +0000 (20:46 +0100)
arch/x86/deflate_quick.c
deflate_medium.c

index 6d727f072e1a3d5bb4a1a478522cb7aa68a7a4ec..f9489822c80a114abb00abd954ac5751a1d44916 100644 (file)
@@ -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;
     }
index 4e454de32a37852fa7b6e2665965db75942bb2bc..eab1d2e9b0f178a4d9634fe9cfeea8179310416d 100644 (file)
@@ -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;