httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1572670 - /httpd/httpd/trunk/modules/filters/mod_deflate.c
Date Thu, 27 Feb 2014 18:08:35 GMT
Author: ylavic
Date: Thu Feb 27 18:08:34 2014
New Revision: 1572670

URL: http://svn.apache.org/r1572670
Log:
Commit 5 on 6 to fix reentrance (incomplete Zlib header or validation bytes) in mod_deflate's
output and input filters.
PR 46146 (patches from duplicated PR 55666)

Handle Zlib flags in the inflate input filter as in the output filter, using consume_zlib_flags().

Modified:
    httpd/httpd/trunk/modules/filters/mod_deflate.c

Modified: httpd/httpd/trunk/modules/filters/mod_deflate.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_deflate.c?rev=1572670&r1=1572669&r2=1572670&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_deflate.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_deflate.c Thu Feb 27 18:08:34 2014
@@ -1087,10 +1087,10 @@ static apr_status_t deflate_in_filter(ap
             return APR_EGENERAL;
         }
 
-        /* We can't handle flags for now. */
-        if (ctx->header[3] != 0) {
+        ctx->zlib_flags = ctx->header[3];
+        if ((ctx->zlib_flags & RESERVED)) {
             ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01388)
-                          "Zlib: Unsupported flags %02x", (int)ctx->header[3]);
+                          "Zlib: Invalid flags %02x", ctx->zlib_flags);
             return APR_EGENERAL;
         }
 
@@ -1188,6 +1188,16 @@ static apr_status_t deflate_in_filter(ap
             /* read */
             apr_bucket_read(bkt, &data, &len, APR_BLOCK_READ);
 
+            if (ctx->zlib_flags) {
+                rv = consume_zlib_flags(ctx, &data, &len);
+                if (rv == APR_SUCCESS) {
+                    ctx->zlib_flags = 0;
+                }
+                if (rv == APR_INCOMPLETE || !len) {
+                    continue;
+                }
+            }
+
             /* pass through zlib inflate. */
             ctx->stream.next_in = (unsigned char *)data;
             ctx->stream.avail_in = len;



Mime
View raw message