[php-src] PR #21852: zlib/bz2: add max_output filter param to cap decompression output
| From: | iliaal | Date: | Thu, 23 Apr 2026 15:00:48 +0000 |
| Subject: | [php-src] PR #21852: zlib/bz2: add max_output filter param to cap decompression output | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35856@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21852
Author: iliaal
Adds
max_output to zlib.inflate and bzip2.decompress. When
set, the filter tracks emitted bytes; once the cap is exceeded, the current bucket is dropped and
the filter returns PSFS_ERR_FATAL, halting decompression mid-stream rather than after
the full payload lands on the sink.
Opt-in on both filters. Omitting the key keeps existing behavior for every current caller. From
userland: stream_filter_append($stream, 'zlib.inflate', STREAM_FILTER_WRITE,
['max_output' => N]).
A follow-up PR will wire this into phar so crafted archives with inflated
uncompressed_filesize fail during streaming.