Skip to content

Commit 2a1a8f9

Browse files
hughdavenportweltling
authored andcommitted
Fixed bug #70183 null pointer deref (segfault) in zend_eval_const_expr
1 parent 8e528b2 commit 2a1a8f9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Zend/tests/bug70183.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--TEST--
2+
Bug #70183 (null pointer deref (segfault) in zend_eval_const_expr)
3+
--FILE--
4+
<?php
5+
[[][]]
6+
?>
7+
--EXPECTF--
8+
Fatal error: Cannot use [] for reading in %sbug70183.php on line %d

Zend/zend_compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7374,7 +7374,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
73747374

73757375
zend_eval_const_expr(&ast->child[0]);
73767376
zend_eval_const_expr(&ast->child[1]);
7377-
if (ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) {
7377+
if (!ast->child[0] || !ast->child[1] || ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) {
73787378
return;
73797379
}
73807380

0 commit comments

Comments
 (0)