]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix only one half of a macro is executed in the correct side of the conditional,
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Mon, 13 Feb 2017 19:38:35 +0000 (20:38 +0100)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Mon, 13 Feb 2017 19:38:35 +0000 (20:38 +0100)
causing the potential for hash corruption on calls to deflateParam() to change
level from 0 to something else.

deflate.c

index a11b5ebda96d94f7131af1ffd144f86aedc21897..30e5cb01c12347059430380eaaf929c99a81cd61 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -552,10 +552,11 @@ int ZEXPORT deflateParams(z_stream *strm, int level, int strategy) {
     }
     if (s->level != level) {
         if (s->level == 0 && s->matches != 0) {
-            if (s->matches == 1)
+            if (s->matches == 1) {
                 slide_hash(s);
-            else
+            } else {
                 CLEAR_HASH(s);
+            }
             s->matches = 0;
         }
         s->level = level;