Skip to content

Commit 084afea

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix use-after-free in zend_compile_const_decl() under opcache (#25302)
2 parents fd9b8e7 + b3a8e07 commit 084afea

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎NEWS‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ PHP NEWS
1616
cached). (lazerg)
1717
. Fixed bug GH-25265 (Misaligned read for virtual internal props in
1818
hooked subclass). (Lazizbek Ergashev)
19+
. Fixed bug GH-25302 (Use-after-free in zend_compile_const_decl() with
20+
OPcache during concurrent compilation). (Nicolas Grekas)
1921

2022
- Curl:
2123
. Fixed curl_reset() retaining CURLOPT_PRIVATE after reset. (lacatoire)

‎Zend/zend_compile.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9715,12 +9715,15 @@ static void zend_compile_const_decl(zend_ast *ast) /* {{{ */
97159715
}
97169716
}
97179717

9718+
/* Register before the literal takes the name: interning it there may
9719+
* release it, when opcache has put the same string in shared memory
9720+
* since the call above. */
9721+
zend_register_seen_symbol(name, ZEND_SYMBOL_CONST);
9722+
97189723
name_node.op_type = IS_CONST;
97199724
ZVAL_STR(&name_node.u.constant, name);
97209725

97219726
last_op = zend_emit_op(NULL, ZEND_DECLARE_CONST, &name_node, &value_node);
9722-
9723-
zend_register_seen_symbol(name, ZEND_SYMBOL_CONST);
97249727
}
97259728
if (attributes_ast == NULL) {
97269729
return;

0 commit comments

Comments
 (0)