Bug #75273 [Ana->Csd]: php_zlib_inflate_filter() may not update bytes_consumed
| From: | cmb@php.net | Date: | Sat, 08 Sep 2018 17:16:18 +0000 |
| Subject: | Bug #75273 [Ana->Csd]: php_zlib_inflate_filter() may not update bytes_consumed | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-216934@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75273&edit=1
ID: 75273
Updated by: cmb@php.net
Reported by: burmartke at gmail dot com
Summary: php_zlib_inflate_filter() may not update
bytes_consumed
-Status: Analyzed
+Status: Closed
Type: Bug
Package: Zlib related
PHP Version: Irrelevant
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=90d863898cd4d7a1e073916b4730aca33cc29184
Log: Fix #75273: php_zlib_inflate_filter() may not update bytes_consumed
Previous Comments:
------------------------------------------------------------------------
[2018-09-08 16:40:59] cmb@php.net
Thanks for forwarding this issue, and for the patch!
------------------------------------------------------------------------
[2017-09-28 09:12:29] burmartke at gmail dot com
Description:
------------
php_zlib_inflate_filter() fails to update the passed-in bytes_consumed parameter if the last buffer
does not produce output, which results in fwrite() returning 0.
It's particularly noticeable if the Debian path "0022-lp564920-fix-big-files.patch"
(from eg https://launchpad.net/ubuntu/+archive/primary/+files/php7.0_7.0.22-0ubuntu0.17.04.1.debian.tar.xz)
is applied, which disables memory mapping for files > 4MB, as it can cause PharData to throw an
exception. See https://github.com/wp-cli/wp-cli/issues/4370#issuecomment-331156677
and https://github.com/wp-cli/wp-cli/issues/4370#issuecomment-331448980
for details.
Test script:
---------------
https://gist.github.com/gitlost/e9895e7687b153c860cddbb1bfec5933
Expected result:
----------------
Nothing.
Actual result:
--------------
bug i=1 out_data_len=32769 fwrite_len=0
bug i=2 out_data_len=32770 fwrite_len=0
bug i=3 out_data_len=32771 fwrite_len=0
bug i=4 out_data_len=32772 fwrite_len=0
bug i=5 out_data_len=32773 fwrite_len=0
bug i=6 out_data_len=32774 fwrite_len=0
bug i=7 out_data_len=32775 fwrite_len=0
bug i=8 out_data_len=32776 fwrite_len=0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75273&edit=1