Patch zlib_inflate_filter_bytes_consumed_bug.patch for Zlib related Bug #75273
Patch version 2017-09-28 09:13 UTC
Return to Bug #75273 |
Download this patch
Patch Revisions:
Developer: burmartke@gmail.com
diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c
index 499eb2755e..7dfdaaf96d 100644
--- a/ext/zlib/zlib_filter.c
+++ b/ext/zlib/zlib_filter.c
@@ -80,12 +80,7 @@ static php_stream_filter_status_t php_zlib_inflate_filter(
bucket = php_stream_bucket_make_writeable(buckets_in->head TSRMLS_CC);
- while (bin < (unsigned int) bucket->buflen) {
-
- if (data->finished) {
- consumed += bucket->buflen;
- break;
- }
+ while (bin < (unsigned int) bucket->buflen && !data->finished) {
desired = bucket->buflen - bin;
if (desired > data->inbuf_len) {
@@ -98,6 +93,7 @@ static php_stream_filter_status_t php_zlib_inflate_filter(
if (status == Z_STREAM_END) {
inflateEnd(&(data->strm));
data->finished = '\1';
+ exit_status = PSFS_PASS_ON;
} else if (status != Z_OK) {
/* Something bad happened */
php_stream_bucket_delref(bucket TSRMLS_CC);
@@ -119,10 +115,6 @@ 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;
- } 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;
}
}
|