From: Greg Beaver Date: Sat, 12 Jan 2008 22:03:44 +0000 (+0000) Subject: MFB: far better fix for bug #40189 X-Git-Tag: RELEASE_2_0_0a1~932 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27fa0688cc7ed715c96a4ed23aac62ec76eb3bf3;p=php MFB: far better fix for bug #40189 --- diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c index 8bf9c34df0..b0b2c6586d 100644 --- a/ext/bz2/bz2_filter.c +++ b/ext/bz2/bz2_filter.c @@ -108,7 +108,7 @@ static php_stream_filter_status_t php_bz2_decompress_filter( consumed += desired; bin += desired; - if (status == BZ_STREAM_END || data->strm.avail_out < data->outbuf_len) { + if (data->strm.avail_out < data->outbuf_len) { php_stream_bucket *out_bucket; size_t bucketlen = data->outbuf_len - data->strm.avail_out; out_bucket = php_stream_bucket_new(stream, estrndup(data->outbuf, bucketlen), bucketlen, 1, 0 TSRMLS_CC); @@ -116,13 +116,10 @@ static php_stream_filter_status_t php_bz2_decompress_filter( data->strm.avail_out = data->outbuf_len; data->strm.next_out = data->outbuf; exit_status = PSFS_PASS_ON; - if (status == BZ_STREAM_END) { - /* no more data to decompress, and nothing was spat out */ - if (data->strm.avail_out >= data->outbuf_len) { - php_stream_bucket_delref(bucket TSRMLS_CC); - } - return PSFS_PASS_ON; - } + } else if (status == BZ_STREAM_END && data->strm.avail_out >= data->outbuf_len) { + /* no more data to decompress, and nothing was spat out */ + php_stream_bucket_delref(bucket TSRMLS_CC); + return PSFS_PASS_ON; } } php_stream_bucket_delref(bucket TSRMLS_CC); diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c index ab24f3afe8..03f8bfc282 100644 --- a/ext/zlib/zlib_filter.c +++ b/ext/zlib/zlib_filter.c @@ -114,11 +114,9 @@ static php_stream_filter_status_t php_zlib_inflate_filter( data->strm.avail_out = data->outbuf_len; data->strm.next_out = data->outbuf; exit_status = PSFS_PASS_ON; - if (status == Z_STREAM_END) { + if (status == Z_STREAM_END && data->strm.avail_out >= data->outbuf_len) { /* no more data to decompress, and nothing was spat out */ - if (data->strm.avail_out >= data->outbuf_len) { - php_stream_bucket_delref(bucket TSRMLS_CC); - } + php_stream_bucket_delref(bucket TSRMLS_CC); return PSFS_PASS_ON; } }