[GIT-PULLS] [php-src] PR #23439: Fix read buffer compaction in stream filter flush

[email protected] (crystarm)
Newsgroups php.git-pulls
Message-ID <[email protected]>
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)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.