Skip to content

Commit 87499e4

Browse files
authored
Fix use of magic const within const expr cast (GH-18338)
Fixes OSS-Fuzz #410939023
1 parent 66d5cf8 commit 87499e4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Zend/tests/oss_fuzz_410939023.phpt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
OSS-Fuzz #410939023: Use of magic const within const expr cast
3+
--FILE--
4+
<?php
5+
6+
const C = (string)__METHOD__;
7+
var_dump(C);
8+
9+
?>
10+
--EXPECT--
11+
string(0) ""

Zend/zend_compile.c

+3
Original file line numberDiff line numberDiff line change
@@ -12127,6 +12127,9 @@ static void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
1212712127
zend_eval_const_expr(&ast->child[0]);
1212812128
zend_eval_const_expr(&ast->child[1]);
1212912129
return;
12130+
case ZEND_AST_CAST:
12131+
zend_eval_const_expr(&ast->child[0]);
12132+
return;
1213012133
default:
1213112134
return;
1213212135
}

0 commit comments

Comments
 (0)