[php-src] PR #25876: sapi/phpdbg: Fix use-after-free releasing recursive watchpoints on arrays
| From: | iliaal | Date: | Sat, 28 Nov 2026 15:31:19 +0000 |
| Subject: | [php-src] PR #25876: sapi/phpdbg: Fix use-after-free releasing recursive watchpoints on arrays | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41161@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25876
Author: iliaal
With
w r $a on an array, phpdbg registered the watchpoint id on the internal
$a[] child instead of the watch the user created. That child is freed whenever the
watch's subtree is torn down, so phpdbg_release_watch_elements() read freed memory
at script end and w d deleted the wrong watch. Registering the real watch exposed a
second use-after-free in phpdbg_remove_watch_element(), which freed a recursive
root's child before recursing into it; that already crashed when deleting a recursive watch
whose variable had become an array. The notice for such a watch now reads [Added recursive
watchpoint #N for $a], as it does for w r on a non-array.