Skip to content

Conversation

@ndossche
Copy link
Member

@ndossche ndossche commented Nov 1, 2025

The problem is that the code is doing php_output_handler_free in a loop on the output stack, but prior to freeing the pointer on the stack in php_output_handler_free it calls php_output_handler_dtor which can run user code that reallocates the stack, resulting in a dangling pointer freed by php_output_handler_free. Furthermore, OG(active) is set when creating a new output handler, but the loop is supposed to clean up all handlers, so OG(active) must be reset as well.

…rt() during error deactivation

The problem is that the code is doing `php_output_handler_free` in a loop on the output stack,
but prior to freeing the pointer on the stack in `php_output_handler_free` it calls
`php_output_handler_dtor` which can run user code that reallocates the stack,
resulting in a dangling pointer freed by php_output_handler_free.
Furthermore, OG(active) is set when creating a new output handler, but
the loop is supposed to clean up all handlers, so OG(active) must be
reset as well.
@ndossche ndossche marked this pull request as ready for review November 2, 2025 09:43
@ndossche ndossche requested a review from bukka as a code owner November 2, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UAF in php_output_handler_free via re-entrant ob_start() during error deactivation

2 participants