]> granicus.if.org Git - php/commitdiff
MFH: far better fix for bug #40189
authorGreg Beaver <cellog@php.net>
Sat, 12 Jan 2008 22:04:03 +0000 (22:04 +0000)
committerGreg Beaver <cellog@php.net>
Sat, 12 Jan 2008 22:04:03 +0000 (22:04 +0000)
ext/bz2/bz2_filter.c
ext/zlib/zlib_filter.c

index c8fc59ef2f64f99bfa4f5fd922dc18a07cb3377b..5c986fc5a83722c5fe5aa8c0968965cfe237bbd9 100644 (file)
@@ -101,7 +101,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);
@@ -109,13 +109,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);
index 80359498ecbb434d8f22c2223f621d7d4ee82f51..789d22fcb856eeb6c870cccef1aa518cbcf7c2dd 100644 (file)
@@ -100,7 +100,7 @@ static php_stream_filter_status_t php_zlib_inflate_filter(
                        consumed += desired;
                        bin += desired;
 
-                       if (status == Z_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);
@@ -108,14 +108,12 @@ 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) {
-                                       /* 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 == Z_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);
        }