]> git.kaiwu.me - nginx.git/commitdiff
Merge of r4966: gzip: fixed zlib memLevel adjusting.
authorMaxim Dounin <mdounin@mdounin.ru>
Sun, 10 Feb 2013 03:52:26 +0000 (03:52 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Sun, 10 Feb 2013 03:52:26 +0000 (03:52 +0000)
An incorrect memLevel (lower than 1) might be passed to deflateInit2() if the
"gzip_hash" directive is set to a value less than the value of "gzip_window"
directive. This resulted in "deflateInit2() failed: -2" alert and an empty
reply.

src/http/modules/ngx_http_gzip_filter_module.c

index 128d3d9c89de543fd3d971fbb1642c578313d88b..964f4fd272c21ab7d0f2c753f77da72cb48a0dbb 100644 (file)
@@ -497,6 +497,10 @@ ngx_http_gzip_filter_memory(ngx_http_request_t *r, ngx_http_gzip_ctx_t *ctx)
             wbits--;
             memlevel--;
         }
+
+        if (memlevel < 1) {
+            memlevel = 1;
+        }
     }
 
     ctx->wbits = wbits;