-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix GH-15210: phpdbg_print_changed_zvals working on a real copy instead. #15229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--TEST-- | ||
GH-15210 use after free after continue | ||
--CREDITS-- | ||
YuanchengJiang | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't really use credit sections any longer, as those were more to go around the limitations of SVN There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okidoki |
||
--PHPDBG-- | ||
b 4 | ||
r | ||
w $a[0] | ||
w r $b | ||
c | ||
q | ||
--FILE-- | ||
<?php | ||
header_register_callback(function() { echo "sent";}); | ||
$a = [0]; | ||
$a[0] = 1; | ||
$b = &$a; | ||
$a[0] = 2; | ||
$a[1] = 3; | ||
$c = [1]; | ||
$b = &$c; | ||
?> | ||
--EXPECTF-- | ||
[Successful compilation of %s] | ||
prompt> [Breakpoint #0 added at %s:%d] | ||
prompt> [Breakpoint #0 at %s:%d, hits: 1] | ||
>00004: $a[0] = 1; | ||
00005: $b = &$a; | ||
00006: $a[0] = 2; | ||
prompt> [Added watchpoint #0 for $a[0]] | ||
prompt> [Added recursive watchpoint #1 for $b] | ||
prompt> [Breaking on watchpoint $a[0]] | ||
Old value: [Breaking on watchpoint $a[0]] | ||
Old value: 0 | ||
New value: 1 | ||
>00002: header_register_callback(function() { echo "sent";}); | ||
00003: $a = [0]; | ||
00004: $a[0] = 1; | ||
prompt> [$a[0] has been removed, removing watchpoint] | ||
[$b has been removed, removing watchpoint recursively] |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't totally understand why we need to duplicate the memory? Is it because the HashTable might be allocated with ZMM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in fact is to avoid the hashtable corruption of the original watchpoint list, working on a copy then copy back once all is done. it fixed the issue for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would increasing the refcounter on the HashTable also fix it or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems to work if I allow cow violation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be wrong, we need a temporary hash table so that resizes don't cause problems. Increasing the refcount won't protect you against that and only papers over the real issue.