summaryrefslogtreecommitdiff
path: root/ext/zlib
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-01-25 12:22:21 +0000
committerAntony Dovgal <tony2001@php.net>2007-01-25 12:22:21 +0000
commit0bc0e57b855c7b8c3919fd2cb944b13ea0565d48 (patch)
treef55c09d7240af8ff73661895b889de1f32e081f2 /ext/zlib
parentde3c2038af4870a340c770c56511c4f239128999 (diff)
downloadphp-git-0bc0e57b855c7b8c3919fd2cb944b13ea0565d48.tar.gz
MFH: fix #40189 (possible endless loop in zlib.inflate stream filter)
Diffstat (limited to 'ext/zlib')
-rw-r--r--ext/zlib/zlib_filter.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c
index 240da21646..1fa090f86c 100644
--- a/ext/zlib/zlib_filter.c
+++ b/ext/zlib/zlib_filter.c
@@ -100,6 +100,11 @@ static php_stream_filter_status_t php_zlib_inflate_filter(
consumed += desired;
bin += desired;
+ if (!desired) {
+ flags |= PSFS_FLAG_FLUSH_CLOSE;
+ break;
+ }
+
if (data->strm.avail_out < data->outbuf_len) {
php_stream_bucket *out_bucket;
size_t bucketlen = data->outbuf_len - data->strm.avail_out;
@@ -208,6 +213,11 @@ static php_stream_filter_status_t php_zlib_deflate_filter(
consumed += desired;
bin += desired;
+ if (!desired) {
+ flags |= PSFS_FLAG_FLUSH_CLOSE;
+ break;
+ }
+
if (data->strm.avail_out < data->outbuf_len) {
php_stream_bucket *out_bucket;
size_t bucketlen = data->outbuf_len - data->strm.avail_out;