View | Details | Raw Unified | Return to bug 56872
Collapse All | Expand All

(-)a/modules/filters/mod_deflate.c (-20 / +21 lines)
Lines 1370-1395 static apr_status_t deflate_in_filter(ap_filter_t *f, Link Here
1370
                        ctx->stream.next_out = ctx->buffer;
1370
                        ctx->stream.next_out = ctx->buffer;
1371
                        len = c->bufferSize - ctx->stream.avail_out;
1371
                        len = c->bufferSize - ctx->stream.avail_out;
1372
1372
1373
                        ctx->inflate_total += len;
1374
                        if (inflate_limit && ctx->inflate_total > inflate_limit) { 
1375
                            inflateEnd(&ctx->stream);
1376
                            ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02648)
1377
                                    "Inflated content length of %" APR_OFF_T_FMT
1378
                                    " is larger than the configured limit"
1379
                                    " of %" APR_OFF_T_FMT, 
1380
                                    ctx->inflate_total, inflate_limit);
1381
                            return APR_ENOSPC;
1382
                        }
1383
1384
                        if (!check_ratio(r, ctx, dc)) {
1385
                            inflateEnd(&ctx->stream);
1386
                            ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02649)
1387
                                    "Inflated content ratio is larger than the "
1388
                                    "configured limit %i by %i time(s)",
1389
                                    dc->ratio_limit, dc->ratio_burst);
1390
                            return APR_EINVAL;
1391
                        }
1392
1393
                        ctx->crc = crc32(ctx->crc, (const Bytef *)ctx->buffer, len);
1373
                        ctx->crc = crc32(ctx->crc, (const Bytef *)ctx->buffer, len);
1394
                        tmp_heap = apr_bucket_heap_create((char *)ctx->buffer, len,
1374
                        tmp_heap = apr_bucket_heap_create((char *)ctx->buffer, len,
1395
                                                          NULL, f->c->bucket_alloc);
1375
                                                          NULL, f->c->bucket_alloc);
Lines 1398-1403 static apr_status_t deflate_in_filter(ap_filter_t *f, Link Here
1398
                    }
1378
                    }
1399
1379
1400
                    zRC = inflate(&ctx->stream, Z_NO_FLUSH);
1380
                    zRC = inflate(&ctx->stream, Z_NO_FLUSH);
1381
                    len = c->bufferSize - ctx->stream.avail_out;
1382
1383
                    ctx->inflate_total += len;
1384
                    if (inflate_limit && ctx->inflate_total > inflate_limit) { 
1385
                        inflateEnd(&ctx->stream);
1386
                        ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02648)
1387
                                "Inflated content length of %" APR_OFF_T_FMT
1388
                                " is larger than the configured limit"
1389
                                " of %" APR_OFF_T_FMT, 
1390
                                ctx->inflate_total, inflate_limit);
1391
                        return APR_ENOSPC;
1392
                    }
1393
1394
                    if (!check_ratio(r, ctx, dc)) {
1395
                        inflateEnd(&ctx->stream);
1396
                        ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02649)
1397
                                "Inflated content ratio is larger than the "
1398
                                "configured limit %i by %i time(s)",
1399
                                dc->ratio_limit, dc->ratio_burst);
1400
                        return APR_EINVAL;
1401
                    }
1401
1402
1402
                    if (zRC == Z_STREAM_END) {
1403
                    if (zRC == Z_STREAM_END) {
1403
                        ctx->validation_buffer = apr_pcalloc(r->pool,
1404
                        ctx->validation_buffer = apr_pcalloc(r->pool,

Return to bug 56872