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

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

Return to bug 56872