From: Jan Kaluža Date: Wed, 26 Feb 2014 15:30:25 +0000 (+0000) Subject: mod_deflate: fix decompression of files larger than 4GB. According to RFC1952, X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0539c73529f00acb82dd636d29316acbed9e3b99;p=thirdparty%2Fapache%2Fhttpd.git mod_deflate: fix decompression of files larger than 4GB. According to RFC1952, Input SIZE (compLen) contains the size of the original input data modulo 2^32. PR: 56062 Submitted by: Lukas Bezdicka git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1572092 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index 43ae858380d..2166665f771 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -1125,7 +1125,8 @@ static apr_status_t deflate_in_filter(ap_filter_t *f, } ctx->stream.next_in += 4; compLen = getLong(ctx->stream.next_in); - if (ctx->stream.total_out != compLen) { + /* gzip stores original size only as 4 byte value */ + if ((ctx->stream.total_out & 0xFFFFFFFF) != compLen) { inflateEnd(&ctx->stream); ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01395) "Zlib: Length %ld of inflated data does " @@ -1322,7 +1323,8 @@ static apr_status_t inflate_out_filter(ap_filter_t *f, } ctx->validation_buffer += VALIDATION_SIZE / 2; compLen = getLong(ctx->validation_buffer); - if (ctx->stream.total_out != compLen) { + /* gzip stores original size only as 4 byte value */ + if ((ctx->stream.total_out & 0xFFFFFFFF) != compLen) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01400) "Zlib: Length of inflated stream invalid"); return APR_EGENERAL;