]> git.kaiwu.me - nginx.git/commitdiff
Gzip: fixed zlib memLevel adjusting.
authorValentin Bartenev <vbart@nginx.com>
Fri, 14 Dec 2012 15:17:58 +0000 (15:17 +0000)
committerValentin Bartenev <vbart@nginx.com>
Fri, 14 Dec 2012 15:17:58 +0000 (15:17 +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 09994d9b204e858609c0613edbf36c27d5c0655f..470be3daf20e33293e8260ab8080476ffb194344 100644 (file)
@@ -498,6 +498,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;