Repository navigation
Conversation
…rays A recursive watch on an array registered its id on the child element phpdbg creates for the array rather than on the watch root. The root owns that child and frees it whenever its subtree is torn down, leaving a dangling pointer in watch_elements that phpdbg_release_watch_elements() read at shutdown. Register the root instead, and let phpdbg_remove_watch_element() leave a root's subtree to phpdbg_remove_watch_element_recursively(): it freed the root's child before recursing into it, which already crashed on deleting a recursive watch whose variable had become an array.
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.
With
w r $aon 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, sophpdbg_release_watch_elements()read freed memory at script end andw ddeleted the wrong watch. Registering the real watch exposed a second use-after-free inphpdbg_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 forw ron a non-array.