summaryrefslogtreecommitdiff
path: root/ext/opcache/Optimizer
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-11-27 17:43:24 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-11-27 17:44:30 +0100
commita505fc627ecd4c146e10e05995816fba14f1f1b6 (patch)
tree83b19fd4a5ce7ead0f6b8189222104c76b862690 /ext/opcache/Optimizer
parenta87d620543070decfcadd8831f3b95341135ec0c (diff)
downloadphp-git-a505fc627ecd4c146e10e05995816fba14f1f1b6.tar.gz
Fix handling of sccp exceptions
We should clear the exception *before* we destroy the execute_data. Add a variation of the test that indirects through another file, and would crash otherwise.
Diffstat (limited to 'ext/opcache/Optimizer')
-rw-r--r--ext/opcache/Optimizer/sccp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c
index 1c4330717b..9f122296f5 100644
--- a/ext/opcache/Optimizer/sccp.c
+++ b/ext/opcache/Optimizer/sccp.c
@@ -1046,16 +1046,17 @@ static inline int ct_eval_func_call(
for (i = 0; i < num_args; i++) {
zval_ptr_dtor_nogc(EX_VAR_NUM(i));
}
- efree(execute_data);
- EG(current_execute_data) = prev_execute_data;
+ int retval = SUCCESS;
if (EG(exception)) {
zval_ptr_dtor(result);
zend_clear_exception();
- return FAILURE;
+ retval = FAILURE;
}
- return SUCCESS;
+ efree(execute_data);
+ EG(current_execute_data) = prev_execute_data;
+ return retval;
}
#define SET_RESULT(op, zv) do { \