From 21562aa98dd423a988770aee974377a77d980839 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 15 Jan 2021 16:58:01 +0100 Subject: Check for append to $GLOBALS Fixes oss-fuzz #29389. --- Zend/zend_compile.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Zend/zend_compile.c') diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 58cd190b68..06c0034bc2 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2773,6 +2773,10 @@ static zend_op *zend_delayed_compile_dim(znode *result, zend_ast *ast, uint32_t znode var_node, dim_node; if (is_globals_fetch(var_ast)) { + if (dim_ast == NULL) { + zend_error_noreturn(E_COMPILE_ERROR, "Cannot append to $GLOBALS"); + } + zend_compile_expr(&dim_node, dim_ast); if (dim_node.op_type == IS_CONST) { convert_to_string(&dim_node.u.constant); -- cgit v1.2.1