-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Trampoline crash on error #17216
Labels
Comments
nielsdos
added
Category: Engine
Status: Verified
and removed
Status: Needs Triage
labels
Dec 19, 2024
Simplified: <?php
class TrampolineTest {
public function __call(string $name, array $arguments) {
}
}
$o = new TrampolineTest();
$callback = [$o, 'trampoline'];
$array = ["a" => "b", 1];
forward_static_call_array($callback, $array); |
Probably this, but need to check better later: diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 9ebc15f3a43..8b3d2618112 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -884,7 +884,11 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_
ZEND_CALL_NUM_ARGS(call) = i;
cleanup_args:
zend_vm_stack_free_args(call);
+ if (ZEND_CALL_INFO(call) & ZEND_CALL_HAS_EXTRA_NAMED_PARAMS) {
+ zend_free_extra_named_params(call->extra_named_params);
+ }
zend_vm_stack_free_call_frame(call);
+ zend_release_fcall_info_cache(fci_cache);
return SUCCESS;
}
}
|
nielsdos
changed the title
Assertion failure Zend/zend_execute_API.c:518
Trampoline crash on error
Dec 19, 2024
nielsdos
added a commit
to nielsdos/php-src
that referenced
this issue
Dec 19, 2024
The error handling is incomplete on argument cleanup. 1. The fci is not cleared which means that zend_free_trampoline() is never called. 2. The cleaning for extra named arguments was missing, resulting in memory leak.
nielsdos
added a commit
that referenced
this issue
Dec 20, 2024
* PHP-8.3: Fix GH-17216: Trampoline crash on error
nielsdos
added a commit
that referenced
this issue
Dec 20, 2024
* PHP-8.4: Fix GH-17216: Trampoline crash on error
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
The following code:
Resulted in this output:
PHP Version
nightly
Operating System
No response
The text was updated successfully, but these errors were encountered: