Fixed bug #70183 null pointer deref (segfault) in zend_eval_const_expr

This commit is contained in:
Hugh Davenport 2015-08-02 16:51:23 +02:00 committed by Anatol Belski
parent 8e528b2792
commit 2a1a8f9ea7
2 changed files with 9 additions and 1 deletions

8
Zend/tests/bug70183.phpt Normal file
View File

@ -0,0 +1,8 @@
--TEST--
Bug #70183 (null pointer deref (segfault) in zend_eval_const_expr)
--FILE--
<?php
[[][]]
?>
--EXPECTF--
Fatal error: Cannot use [] for reading in %sbug70183.php on line %d

View File

@ -7374,7 +7374,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
zend_eval_const_expr(&ast->child[0]);
zend_eval_const_expr(&ast->child[1]);
if (ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) {
if (!ast->child[0] || !ast->child[1] || ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) {
return;
}