Skip to content

Commit 025ac98

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Fix use-of-uninitialized-value in zend_get_arg_offset_by_name()
2 parents 1ac68e7 + 657dfc9 commit 025ac98

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Zend/zend_execute.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5454,9 +5454,9 @@ static zend_always_inline uint32_t zend_get_arg_offset_by_name(
54545454
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)
54555455
|| EXPECTED(fbc->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) {
54565456
for (uint32_t i = 0; i < num_args; i++) {
5457-
zend_arg_info *arg_info = &fbc->op_array.arg_info[i];
5457+
zend_arg_info *arg_info = &fbc->common.arg_info[i];
54585458
if (zend_string_equals(arg_name, arg_info->name)) {
5459-
if (!fbc->op_array.refcount || !(fbc->op_array.fn_flags & ZEND_ACC_CLOSURE)) {
5459+
if (fbc->type == ZEND_USER_FUNCTION && (!fbc->op_array.refcount || !(fbc->op_array.fn_flags & ZEND_ACC_CLOSURE))) {
54605460
*cache_slot = unique_id;
54615461
*(uintptr_t *)(cache_slot + 1) = i;
54625462
}
@@ -5477,7 +5477,10 @@ static zend_always_inline uint32_t zend_get_arg_offset_by_name(
54775477
}
54785478

54795479
if (fbc->common.fn_flags & ZEND_ACC_VARIADIC) {
5480-
if (fbc->type == ZEND_INTERNAL_FUNCTION || !fbc->op_array.refcount || !(fbc->op_array.fn_flags & ZEND_ACC_CLOSURE)) {
5480+
if ((fbc->type == ZEND_USER_FUNCTION
5481+
&& (!fbc->op_array.refcount || !(fbc->op_array.fn_flags & ZEND_ACC_CLOSURE)))
5482+
|| (fbc->type == ZEND_INTERNAL_FUNCTION
5483+
&& !(fbc->common.fn_flags & ZEND_ACC_USER_ARG_INFO))) {
54815484
*cache_slot = unique_id;
54825485
*(uintptr_t *)(cache_slot + 1) = fbc->common.num_args;
54835486
}

0 commit comments

Comments
 (0)