com php-src: Check for missing arginfo arguments: Zend/zend_e xecute.c

From: Date: Tue, 21 Jul 2020 12:17:29 +0000
Subject: com php-src: Check for missing arginfo arguments: Zend/zend_e xecute.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-112291@lists.php.net to get a copy of this message
Commit: 38fb1f83839ceb04de92a3b6eb75cdf37d7686bb Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 16 Jul 2020 20:56:44 +0200 Parents: be0d9126743b9beff7e3bb01fb76030f21f073cf Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=38fb1f83839ceb04de92a3b6eb75cdf37d7686bb Log: Check for missing arginfo arguments Internal functions error when too many arguments are passed. Make this part of the verification we do in debug builds. This will help avoid cases where an argument is missing in the stubs, as recently encountered in 6d96f0f. Changed paths: M Zend/zend_execute.c Diff: diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index b7dce3614c..f6ce352ad8 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -130,7 +130,7 @@ static ZEND_FUNCTION(pass) ZEND_API const zend_internal_function zend_pass_function = { ZEND_INTERNAL_FUNCTION, /* type */ {0, 0, 0}, /* arg_flags */ - 0, /* fn_flags */ + ZEND_ACC_VARIADIC, /* fn_flags */ NULL, /* name */ NULL, /* scope */ NULL, /* prototype */ @@ -1122,6 +1122,14 @@ static zend_never_inline ZEND_ATTRIBUTE_UNUSED int zend_verify_internal_arg_type static zend_always_inline zend_bool zend_internal_call_should_throw(zend_function *fbc, zend_execute_data *call) { if (fbc->common.required_num_args > ZEND_CALL_NUM_ARGS(call)) { + /* Required argument not passed. */ + return 1; + } + + if (fbc->common.num_args < ZEND_CALL_NUM_ARGS(call) + && !(fbc->common.fn_flags & ZEND_ACC_VARIADIC)) { + /* Too many arguments passed. For internal functions (unlike userland functions), + * this should always throw. */ return 1; }

« previous php.cvs (#112291) next »