Discard buckets abandoned by a filter that returns no output - #23564
Open
iliaal wants to merge 1 commit into
Open
Discard buckets abandoned by a filter that returns no output#23564iliaal wants to merge 1 commit into
iliaal wants to merge 1 commit into
Conversation
A user filter can append to its $out brigade and still answer PSFS_FEED_ME or PSFS_ERR_FATAL. _php_stream_filter_flush() returned without touching either brigade, and _php_stream_write_filtered() drained only brig_inp, so those buckets leaked with bucket->brigade still pointing at the caller's stack frame; re-appending such a bucket later writes through it. php_stream_fill_read_buffer() and php_stream_filter_append_ex() already discard them. Closes phpGH-23564
iliaal
force-pushed
the
fix/filter-brigade-drain-84
branch
from
September 4, 2026 12:15
905c28e to
a844281
Compare
This was referenced Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A user filter can append buckets to its $out brigade and still answer PSFS_FEED_ME or PSFS_ERR_FATAL. Both brigades live on the caller's stack frame, so whatever is left on them when the caller returns leaks with bucket->brigade dangling, and re-appending such a bucket later writes through that pointer. php_stream_fill_read_buffer() and php_stream_filter_append_ex() already discard leftovers; _php_stream_filter_flush() returned without touching either brigade, and _php_stream_write_filtered() drained only the input one. Smallest case is a filter that appends one bucket to $out, returns PSFS_ERR_FATAL, and is then passed to stream_filter_remove().