[php-src] PR #25904: Fix GH-25903: bzip2.decompress write filter writes past its input buffer after a data error

From: Date: Sun, 29 Nov 2026 20:16:30 +0000
Subject: [php-src] PR #25904: Fix GH-25903: bzip2.decompress write filter writes past its input buffer after a data error
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-41210@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25904 Author: ArtUkrainskiy Fixes GH-25903 When BZ2_bzDecompress() fails, php_bz2_decompress_filter() returns before it resets next_in and avail_in. bzlib has already moved next_in forward. The filter stays on the stream, so the next write copies its input at the advanced next_in, and the copy can go past the end of the 2048-byte inbuf. This resets both before returning, like zlib.inflate does. The notice now goes last, because an error handler can close the stream and free the filter. zlib.inflate got the same order in #24176. The test writes one byte at a time, so the position moves past the buffer after about 2048 writes. It needs USE_ZEND_ALLOC=0. With the Zend allocator the overflow doesn't crash. Without the fix it aborts in glibc on a debug build and fails with ASan. ext/bz2 tests pass with ASan and ZTS. The code change applies cleanly to 8.5, 8.6 and master.

« previous php.git-pulls (#41210) next »