On Fri, Jul 18, 2014 at 9:14 PM, Yann Ylavic <[email protected]> wrote:
> On Fri, Jul 18, 2014 at 9:11 PM, <[email protected]> wrote:
>> Author: ylavic
>> Date: Fri Jul 18 19:11:10 2014
>> New Revision: 1611771
>>
>> URL: http://svn.apache.org/r1611771
>> Log:
>> mod_deflate proposal v3.
>>
>> Modified:
>> httpd/httpd/branches/2.2.x/STATUS
>>
>> Modified: httpd/httpd/branches/2.2.x/STATUS
>> URL:
>> http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=1611771&r1=1611770&r2=1611771&view=diff
>> ==============================================================================
>> --- httpd/httpd/branches/2.2.x/STATUS (original)
>> +++ httpd/httpd/branches/2.2.x/STATUS Fri Jul 18 19:11:10 2014
>> @@ -157,9 +157,10 @@ PATCHES PROPOSED TO BACKPORT FROM TRUNK:
>> https://svn.apache.org/r1604353
>> https://svn.apache.org/r1611725
>> 2.4.x patch: https://svn.apache.org/r1604458 (2.4.10)
>> - 2.2.x patch:
>> http://people.apache.org/~ylavic/httpd-2.2.x-mod_deflate_reentrant_with_CHANGES_v2.patch
>> + 2.2.x patch:
>> http://people.apache.org/~ylavic/httpd-2.2.x-mod_deflate_reentrant_with_CHANGES_v3.patch
>> (modulo CHANGES)
>> +1: ylavic, wrowe
>> + ylavic: v3 without the merge conflict with PR 56062 above.
>
> Sorry about that William, the v2 patch included the fix for PR 56062
> already accepted above.
> You probably need to (re)vote...
That is, in v2 :
- ctx->stream.next_in += 4;
- compLen = getLong(ctx->stream.next_in);
- if (ctx->stream.total_out != compLen) {
+ compLen = getLong(buf + VALIDATION_SIZE / 2);
+ /* gzip stores original size only as 4 byte value */
+ if ((ctx->stream.total_out & 0xFFFFFFFF) != compLen) {
+ ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
+ "Zlib: Length %ld of inflated data does "
+ "not match expected value %ld",
+ ctx->stream.total_out, compLen);
inflateEnd(&ctx->stream);
return APR_EGENERAL;
}
becomes in v3 :
- ctx->stream.next_in += 4;
- compLen = getLong(ctx->stream.next_in);
+ compLen = getLong(buf + VALIDATION_SIZE / 2);
if (ctx->stream.total_out != compLen) {
+ ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
+ "Zlib: Length %ld of inflated data does "
+ "not match expected value %ld",
+ ctx->stream.total_out, compLen);
inflateEnd(&ctx->stream);
return APR_EGENERAL;
}
and the following from v2 is not needed anymore :
@@ -1253,7 +1477,8 @@ static apr_status_t inflate_out_filter(ap_filter_t
}
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,
"Zlib: Length of inflated stream invalid");
return APR_EGENERAL;