[php-src] PR #20356: Fix GH-20352: UAF in php_output_handler_free via re-entrant ob_start() during error deactivation
| From: | ndossche | Date: | Sat, 01 Nov 2025 23:09:30 +0000 |
| Subject: | [php-src] PR #20356: Fix GH-20352: UAF in php_output_handler_free via re-entrant ob_start() during error deactivation | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-33876@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/20356
Author: ndossche
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.