summaryrefslogtreecommitdiff
path: root/ext/bz2
diff options
context:
space:
mode:
authorGreg Beaver <cellog@php.net>2008-01-12 21:28:48 +0000
committerGreg Beaver <cellog@php.net>2008-01-12 21:28:48 +0000
commit79abe24b1b650b6787554caf29676e093ba4086f (patch)
tree8cd1b14226fb13d3d1a4eec471565938c7e582ec /ext/bz2
parent7c1952c8637d66758d7fa3ffc55e93afca31636d (diff)
downloadphp-git-79abe24b1b650b6787554caf29676e093ba4086f.tar.gz
MFH: fix faulty fix for Bug #40189, and provide real fix for the bug
Diffstat (limited to 'ext/bz2')
-rw-r--r--ext/bz2/bz2_filter.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c
index fe4a11f585..c8fc59ef2f 100644
--- a/ext/bz2/bz2_filter.c
+++ b/ext/bz2/bz2_filter.c
@@ -101,12 +101,7 @@ static php_stream_filter_status_t php_bz2_decompress_filter(
consumed += desired;
bin += desired;
- if (!desired) {
- flags |= PSFS_FLAG_FLUSH_CLOSE;
- break;
- }
-
- if (data->strm.avail_out < data->outbuf_len) {
+ if (status == BZ_STREAM_END || 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);
@@ -114,6 +109,13 @@ 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;
+ }
}
}
php_stream_bucket_delref(bucket TSRMLS_CC);