[php-src] PR #23439: Fix read buffer compaction in stream filter flush
| From: | crystarm | Date: | Mon, 24 Aug 2026 15:23:14 +0000 |
| Subject: | [php-src] PR #23439: Fix read buffer compaction in stream filter flush | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38112@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23439
Author: crystarm
php_stream_filter_flush() compacts unread data before appending buckets produced by a
read filter.
The source and destination ranges may overlap, making the use of memcpy() undefined
behavior. Additionally, readpos was reset before it was subtracted from
writepos, so the buffer size was not adjusted and stale data could remain visible.
Use memmove() and adjust writepos before resetting readpos,
matching the existing buffer compaction logic in php_stream_fill_read_buffer().
The issue was detected by static analysis: [BUFFER_OVERLAP
filter.c:[458:4].log](https://github.com/user-attachments/files/31381411/BUFFER_OVERLAP.filter.c.458.4.log)