com php-src: JIT: UNDEF result on "Illegal offset type" exception: ext/opcache/jit/zend_jit_helpers.c
| From: | Nikita Popov | Date: | Wed, 23 Oct 2019 08:07:48 +0000 |
| Subject: | com php-src: JIT: UNDEF result on "Illegal offset type" exception: ext/opcache/jit/zend_jit_helpers.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109017@lists.php.net to get a copy of this message | ||
Commit: 097184cae715984901bad5d8872e2d4a153ec5bc
Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 22 Oct 2019 14:59:24 +0200
Parents: 3d9bbd1b5367ec562eb4bba9a1d976af81e709db
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=097184cae715984901bad5d8872e2d4a153ec5bc
Log:
JIT: UNDEF result on "Illegal offset type" exception
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 ad4be46c63d..b0d12f4d18d 100644
--- a/ext/opcache/jit/zend_jit_helpers.c
+++ b/ext/opcache/jit/zend_jit_helpers.c
@@ -18,6 +18,15 @@
#include "Zend/zend_API.h"
+static ZEND_COLD void undef_result_after_exception() {
+ const zend_op *opline = EG(opline_before_exception);
+ ZEND_ASSERT(EG(exception));
+ if (opline->result_type & (IS_VAR | IS_TMP_VAR)) {
+ zend_execute_data *execute_data = EG(current_execute_data);
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
+}
+
static zend_never_inline zend_function* ZEND_FASTCALL _zend_jit_init_func_run_time_cache(const
zend_op_array *op_array) /* {{{ */
{
void **run_time_cache;
@@ -469,6 +478,7 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_rw_helper(zend_array *ht, zval *di
goto num_index;
default:
zend_type_error("Illegal offset type");
+ undef_result_after_exception();
return NULL;
}
@@ -537,6 +547,7 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_w_helper(zend_array *ht, zval *dim
goto num_index;
default:
zend_type_error("Illegal offset type");
+ undef_result_after_exception();
return NULL;
}