Skip to content

Commit a232a7a

Browse files
committed
Fix #79177 Check for undefined result in zend_ffi_callback_trampoline.
This situation can happen when userland exception is thrown within callback body.
1 parent 5215f07 commit a232a7a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/ffi/ffi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ static void zend_ffi_callback_trampoline(ffi_cif* cif, void* ret, void** args, v
878878
free_alloca(fci.params, use_heap);
879879

880880
ret_type = ZEND_FFI_TYPE(callback_data->type->func.ret_type);
881-
if (ret_type->kind != ZEND_FFI_TYPE_VOID) {
881+
if (ret_type->kind != ZEND_FFI_TYPE_VOID && Z_TYPE(retval) != IS_UNDEF) {
882882
zend_ffi_zval_to_cdata(ret, ret_type, &retval);
883883
}
884884
}

0 commit comments

Comments
 (0)