Skip to content

Fix GH-25862: Heap overflow when a read filter grows the chunk size - #25865

Open
lazerg wants to merge 1 commit into
php:PHP-8.4from
lazerg:fix/gh-25862
Open

lazerg wants to merge 1 commit into
php:PHP-8.4from
lazerg:fix/gh-25862

Conversation

@lazerg

@lazerg lazerg commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Fixes GH-25862.

_php_stream_fill_read_buffer() allocates chunk_buf with the stream's chunk size once, but then reads stream->chunk_size bytes into it on every loop iteration. A user filter can call stream_set_chunk_size() and return PSFS_FEED_ME, so the next read writes past the end of the buffer. The chunk size is now read once and used for both the allocation and the reads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Heap buffer overflow in _php_stream_fill_read_buffer() when a read filter increases the stream chunk size

2 participants