forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix phpGH-13817: Segmentation fault for enabled observers after pass 4
Instead of fixing up temporaries count in between observer steps, just take ZEND_ACC_DONE_PASS_TWO into account during stack_size calculation. Introducing zend_vm_calc_ct_used_stack for that use case. This should be much less susceptible to forgetting to handle the ZEND_OBSERVER_ENABLED temporary explicitly.
- Loading branch information
Showing
6 changed files
with
67 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,51 @@ | ||
--TEST-- | ||
GH-13712 (Segmentation fault for enabled observers after pass 4) | ||
--EXTENSIONS-- | ||
opcache | ||
zend_test | ||
--INI-- | ||
zend_test.observer.enabled=1 | ||
zend_test.observer.show_output=1 | ||
zend_test.observer.observe_all=1 | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
opcache.optimization_level=0x4069 | ||
--FILE-- | ||
<?php | ||
|
||
function inner() { | ||
echo "Ok\n"; | ||
} | ||
|
||
function foo() { | ||
// If stack size is wrong, inner() will corrupt the previous observed frame | ||
inner(); | ||
} | ||
|
||
// After foo() def so that we land here, with step_two undone for foo() first | ||
function outer() { | ||
// Pass 15 does constant string propagation, which gives a ZEND_INIT_DYNAMIC_FCALL on a const which Pass 4 will optimize | ||
// Pass 4 must calc the right stack size here | ||
(NAME)(); | ||
} | ||
|
||
const NAME = "foo"; | ||
|
||
outer(); | ||
|
||
?> | ||
--EXPECTF-- | ||
<!-- init '%s' --> | ||
<file '%s'> | ||
<!-- init outer() --> | ||
<outer> | ||
<!-- init foo() --> | ||
<foo> | ||
<!-- init inner() --> | ||
<inner> | ||
Ok | ||
</inner> | ||
</foo> | ||
</outer> | ||
</file '%s'> | ||
|