|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75273 php_zlib_inflate_filter() may not update bytes_consumed
Submitted: 2017-09-28 09:12 UTC Modified: 2018-09-08 16:42 UTC
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: burmartke at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Zlib related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2017-09-28 09:12 UTC] burmartke at gmail dot com
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 is applied, which disables memory mapping for files > 4MB, as it can cause PharData to throw an exception. See and for details.

Test script:

Expected result:

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


zlib_inflate_filter_bytes_consumed_bug.patch (last revision 2017-09-28 09:13 UTC by burmartke at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-09-08 16:40 UTC]
-Status: Open +Status: Analyzed -Assigned To: +Assigned To: cmb
 [2018-09-08 16:40 UTC]
Thanks for forwarding this issue, and for the patch!
 [2018-09-08 16:42 UTC]
-Summary: php_zlib_inflate_filter() can return 0 bytes_consumed incorrectly +Summary: php_zlib_inflate_filter() may not update bytes_consumed
 [2018-09-08 17:16 UTC]
Automatic comment on behalf of
Log: Fix #75273: php_zlib_inflate_filter() may not update bytes_consumed
 [2018-09-08 17:16 UTC]
-Status: Analyzed +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 09:01:28 2024 UTC