[php-src] PR #12916: Fix creating a first-class callable from FFI
| From: | nielsdos | Date: | Sat, 09 Dec 2023 20:40:29 +0000 |
| Subject: | [php-src] PR #12916: Fix creating a first-class callable from FFI | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-24476@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/12916
Author: nielsdos
This causes a NULL pointer access because the scope field is being accessed in
zend_closure_call_magic. We get to that function because of the
ZEND_ACC_CALL_VIA_TRAMPOLINE fn_flag that is checked in zend_closure_from_frame. The
zend_closure_from_frame function does not take into account the reserved data or the
internal handler function, causing us to end up in zend_closure_call_magic instead of
the FFI trampoline.
Get rid of the flag, and store the temporary internal function in another reserved slot so we can
clean that up at the end of the FFI trampoline's execution.