Bug #75273 [NEW]: php_zlib_inflate_filter() can return 0 bytes_consumed incorrectly

From: Date: Thu, 28 Sep 2017 09:12:37 +0000
Subject: Bug #75273 [NEW]: php_zlib_inflate_filter() can return 0 bytes_consumed incorrectly
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211411@lists.php.net to get a copy of this message
From: burmartke at gmail dot com Operating system: PHP version: Irrelevant Package: Zlib related Bug Type: Bug Bug description:php_zlib_inflate_filter() can return 0 bytes_consumed incorrectly 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 bug report at https://bugs.php.net/bug.php?id=75273&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75273&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75273&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75273&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=75273&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=75273&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=75273&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=75273&r=needscript Try newer version: https://bugs.php.net/fix.php?id=75273&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=75273&r=support Expected behavior: https://bugs.php.net/fix.php?id=75273&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=75273&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=75273&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=75273&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75273&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=75273&r=dst IIS Stability: https://bugs.php.net/fix.php?id=75273&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=75273&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=75273&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=75273&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=75273&r=mysqlcfg

« previous php.bugs (#211411) next »