You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d67f39e
Browse filesBrowse the repository at this point in the historyBrowse files
Fix use-after-free when stream_filter_remove() runs inside a stream callback
stream_filter_remove() flushes the filter before it unlinks and frees it, and
the flush can run PHP code: a user filter's filter() method, or a user
wrapper's stream_write() for the flushed data. When that code removes the
same filter, the outer call continues on freed memory.
A user filter can also be removed from its own filter() method, or from
other code while filter() is suspended in a Fiber; userfilter_filter() and
the filter chain walks then use the freed filter after the callback returns.
userfilter_filter() now counts the calls of each user filter in progress,
a suspended Fiber included, in the u2 of the zval holding the filter object,
so neither php_stream nor php_stream_filter changes. stream_filter_remove()
refuses a filter whose count is not zero, before the flush and again after
it, since a Fiber can enter the filter from the flush, and it checks after
the flush that the filter is still there. Other filters of the stream can
still be removed from a callback.
0 commit comments