From 65d87605d78cadfa64572b81d3b474263d2e6536 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Wed, 16 Apr 2025 17:43:14 +0200 Subject: [PATCH] Fix use of magic const within const expr cast Fixes OSS-Fuzz #410939023 --- Zend/tests/oss_fuzz_410939023.phpt | 11 +++++++++++ Zend/zend_compile.c | 3 +++ 2 files changed, 14 insertions(+) create mode 100644 Zend/tests/oss_fuzz_410939023.phpt diff --git a/Zend/tests/oss_fuzz_410939023.phpt b/Zend/tests/oss_fuzz_410939023.phpt new file mode 100644 index 0000000000000..9c024bf5b5b06 --- /dev/null +++ b/Zend/tests/oss_fuzz_410939023.phpt @@ -0,0 +1,11 @@ +--TEST-- +OSS-Fuzz #410939023: Use of magic const within const expr cast +--FILE-- + +--EXPECT-- +string(0) "" diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 4f18999ffa785..5c15832f80a89 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -12127,6 +12127,9 @@ static void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */ zend_eval_const_expr(&ast->child[0]); zend_eval_const_expr(&ast->child[1]); return; + case ZEND_AST_CAST: + zend_eval_const_expr(&ast->child[0]); + return; default: return; }