Skip to content

Trampoline crash on error #17216

Closed
Closed

Description

@YuanchengJiang

Description

The following code:

<?php
class TrampolineTest {
public function __call(string $name, array $arguments) {
}
}
$o = new TrampolineTest();
$callback = [$o, 'trampoline'];
$arrays = array (
array("str1", "array" => array("hello", 'world'), array(1, 2))
);
foreach($arrays as $arr1) {
}
forward_static_call_array($callback,$arr1);

Resulted in this output:

php: /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_execute_API.c:518: void shutdown_executor(void): Assertion `(((zend_executor_globals *) (((char*) _tsrm_ls_cache)+(executor_globals_offset)))->trampoline).common.function_name == ((void*)0) || (((zend_compiler_globals *) (((char*) _tsrm_ls_cache)+(compiler_globals_offset)))->unclean_shutdown)' failed.
Aborted (core dumped)

PHP Version

nightly

Operating System

No response

Activity

  1. ndossche commented on Dec 19, 2024

    @ndossche
    Member

    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);
  2. ndossche commented on Dec 19, 2024

    @ndossche
    Member

    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;
     					}
     				}
    
  3. changed the title [-]Assertion failure Zend/zend_execute_API.c:518[/-] [+]Trampoline crash on error[/+] on Dec 19, 2024
  4. added a commit that references this issue on Dec 19, 2024
    3bde646
  5. linked a pull request that will close this issueFix GH-17216: Trampoline crash on error #17219on Dec 19, 2024
  6. added 3 commits that reference this issue on Dec 20, 2024
    6274327
    afc1f0d
    2c3b56d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions