[php-src] PR #21806: phar: cap decompression output against declared uncompressed_filesize
| From: | iliaal | Date: | Sat, 18 Apr 2026 18:06:09 +0000 |
| Subject: | [php-src] PR #21806: phar: cap decompression output against declared uncompressed_filesize | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35782@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21806
Author: iliaal
Prevents decompression amplification in
phar_open_entry_fp().
The function decompressed entries by streaming compressed_filesize bytes through a
filter into a tmpfile, then checked the output size after the full copy. A crafted phar whose
compressed data expanded beyond uncompressed_filesize could write large amounts to disk
before the check ran.
Replaces the single php_stream_copy_to_stream_ex() call with an 8 KiB chunked loop that
flushes the decompression filter and checks the running output size after each chunk. Aborts when
output exceeds uncompressed_filesize.