com php-src: Fixed exception handling: ext/opcache/jit/zend_j it_helpers.c

From: Date: Tue, 15 Oct 2019 23:36:06 +0000
Subject: com php-src: Fixed exception handling: ext/opcache/jit/zend_j it_helpers.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-108928@lists.php.net to get a copy of this message
Commit: 51da02375a462f31290c5f93e402c15f08f8e255 Author: Dmitry Stogov <dmitry@zend.com> Wed, 16 Oct 2019 02:36:06 +0300 Parents: 902b00e68e079893fce3b19441bca8dbfc70354c Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=51da02375a462f31290c5f93e402c15f08f8e255 Log: Fixed exception handling Changed paths: M ext/opcache/jit/zend_jit_helpers.c Diff: diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index be941bd2902..b7bc3dec5fe 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -867,7 +867,14 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim, if (Z_TYPE_P(value) != IS_STRING) { /* Convert to string, just the time to pick the 1st byte */ - zend_string *tmp = zval_get_string(value); + zend_string *tmp = zval_try_get_string_func(value); + + if (UNEXPECTED(!tmp)) { + if (result) { + ZVAL_UNDEF(result); + } + return; + } string_len = ZSTR_LEN(tmp); c = (zend_uchar)ZSTR_VAL(tmp)[0]; @@ -920,12 +927,19 @@ static void ZEND_FASTCALL zend_jit_assign_dim_helper(zval *object_ptr, zval *dim if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) { ZVAL_DEREF(value); Z_OBJ_HT_P(object_ptr)->write_dimension(Z_OBJ_P(object_ptr), dim, value); - if (result && EXPECTED(!EG(exception))) { - ZVAL_COPY(result, value); + if (result) { + if (EXPECTED(!EG(exception))) { + ZVAL_COPY(result, value); + } else { + ZVAL_UNDEF(result); + } } } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) { if (!dim) { zend_throw_error(NULL, "[] operator not supported for strings"); + if (result) { + ZVAL_UNDEF(result); + } } else { zend_assign_to_string_offset(object_ptr, dim, value, result); }

« previous php.cvs (#108928) next »