Skip to content

Commit ccc1ac8

Browse files
TimWollailuuu1994
andcommitted
zend_compile: Fix zend_compile_rope_finalize() for ropes containing a single constant string
Without this Opcache will trigger a use-after-free in `zend_optimizer_compact_literals()`. Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
1 parent 72f9b24 commit ccc1ac8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Zend/zend_compile.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10193,6 +10193,8 @@ static void zend_compile_rope_finalize(znode *result, uint32_t rope_elements, ze
1019310193
if (rope_elements == 1) {
1019410194
if (opline->op2_type == IS_CONST) {
1019510195
GET_NODE(result, opline->op2);
10196+
ZVAL_UNDEF(CT_CONSTANT(opline->op2));
10197+
SET_UNUSED(opline->op2);
1019610198
MAKE_NOP(opline);
1019710199
} else {
1019810200
opline->opcode = ZEND_CAST;

0 commit comments

Comments
 (0)