diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-03-13 13:11:42 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-03-13 13:11:42 +0100 |
commit | 9e89f91341be5550f90563f9d531d9fbef44dbd3 (patch) | |
tree | 74f76c9d57d8848f56231f61f77219f64962a38c | |
parent | 9ab2cb923e7732fdaf178af62e8e6be2b59a3a52 (diff) | |
download | php-git-9e89f91341be5550f90563f9d531d9fbef44dbd3.tar.gz |
Add assertions for DIM_W/RW uses
The result should be used only once and on the directly next opline,
otherwise it may not be safe. Add some assertions to that effect.
-rw-r--r-- | ext/opcache/Optimizer/zend_inference.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index da40b59e6c..e11c3cd9c7 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -3299,6 +3299,7 @@ static int zend_update_type_info(const zend_op_array *op_array, || opline->opcode == ZEND_FETCH_LIST_W) { j = ssa_vars[ssa_ops[i].result_def].use_chain; while (j >= 0) { + ZEND_ASSERT(j == i + 1 && "Use must be in next opline"); switch (op_array->opcodes[j].opcode) { case ZEND_FETCH_DIM_W: case ZEND_FETCH_DIM_RW: @@ -3354,6 +3355,7 @@ static int zend_update_type_info(const zend_op_array *op_array, EMPTY_SWITCH_DEFAULT_CASE() } j = zend_ssa_next_use(ssa_ops, ssa_ops[i].result_def, j); + ZEND_ASSERT(j < 0 && "There should only be one use"); } } if ((tmp & MAY_BE_ARRAY) && (tmp & MAY_BE_ARRAY_KEY_ANY)) { |