mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Fix building of callgraph including preloaded symbols (GH-15545)
This issue was introduced in GH-15021. When building the call graph, we can now see preloaded functions. However, building the call graph involves adding the function to the caller list of the callee, which we don't want to do for functions not coming from the script. Fixes GH-15490
This commit is contained in:
parent
b9b317afd4
commit
b839c5f1af
4 changed files with 35 additions and 1 deletions
4
NEWS
4
NEWS
|
@ -34,6 +34,10 @@ PHP NEWS
|
|||
. Fixed bug GH-15432 (Heap corruption when querying a vector). (cmb,
|
||||
Kamil Tekiela)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug GH-15490 (Building of callgraph modifies preloaded symbols).
|
||||
(ilutov)
|
||||
|
||||
- PDO_MYSQL:
|
||||
. mysqlnd: support ER_CLIENT_INTERACTION_TIMEOUT. (Appla)
|
||||
|
||||
|
|
|
@ -79,7 +79,8 @@ ZEND_API void zend_analyze_calls(zend_arena **arena, zend_script *script, uint32
|
|||
|
||||
if (build_flags & ZEND_CALL_TREE) {
|
||||
call_info->next_caller = NULL;
|
||||
} else if (func->type == ZEND_INTERNAL_FUNCTION) {
|
||||
} else if (func->type == ZEND_INTERNAL_FUNCTION
|
||||
|| func->op_array.filename != script->filename) {
|
||||
call_info->next_caller = NULL;
|
||||
} else {
|
||||
zend_func_info *callee_func_info = ZEND_FUNC_INFO(&func->op_array);
|
||||
|
|
9
ext/opcache/tests/jit/gh15490.inc
Normal file
9
ext/opcache/tests/jit/gh15490.inc
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
function foo() {
|
||||
bar();
|
||||
}
|
||||
|
||||
function bar() {
|
||||
echo 'Hello world!';
|
||||
}
|
20
ext/opcache/tests/jit/gh15490.phpt
Normal file
20
ext/opcache/tests/jit/gh15490.phpt
Normal file
|
@ -0,0 +1,20 @@
|
|||
--TEST--
|
||||
GH-15490: use-after-free when traversing call graph
|
||||
--EXTENSIONS--
|
||||
opcache
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=0
|
||||
opcache.preload={PWD}/gh15490.inc
|
||||
opcache.jit=1235
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
foo();
|
||||
?>
|
||||
--EXPECT--
|
||||
Hello world!
|
Loading…
Add table
Add a link
Reference in a new issue