File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 3
3
?? ??? 2015, PHP 7.0.1
4
4
5
5
- Core:
6
+ . Fixed bug #70912 (Null ptr dereference instantiating class with invalid
7
+ array property). (Laruence)
6
8
. Fixed bug #70898, #70895 (null ptr deref and segfault with crafted callable).
7
9
(Anatol, Laruence)
8
10
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #70912 (Null ptr dereference when class property is initialised to a dereferenced value)
3
+ --FILE--
4
+ <?php
5
+ class A {
6
+ public $ a =[][];
7
+ }
8
+ ?>
9
+ --EXPECTF--
10
+ Fatal error: Cannot use [] for reading in %sbug70912.php on line %d
Original file line number Diff line number Diff line change @@ -7381,12 +7381,15 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
7381
7381
case ZEND_AST_DIM :
7382
7382
{
7383
7383
/* constant expression should be always read context ... */
7384
-
7385
7384
zval * container , * dim ;
7386
7385
7386
+ if (ast -> child [1 ] == NULL ) {
7387
+ zend_error_noreturn (E_COMPILE_ERROR , "Cannot use [] for reading" );
7388
+ }
7389
+
7387
7390
zend_eval_const_expr (& ast -> child [0 ]);
7388
7391
zend_eval_const_expr (& ast -> child [1 ]);
7389
- if (! ast -> child [ 0 ] || ! ast -> child [ 1 ] || ast -> child [0 ]-> kind != ZEND_AST_ZVAL || ast -> child [1 ]-> kind != ZEND_AST_ZVAL ) {
7392
+ if (ast -> child [0 ]-> kind != ZEND_AST_ZVAL || ast -> child [1 ]-> kind != ZEND_AST_ZVAL ) {
7390
7393
return ;
7391
7394
}
7392
7395
You can’t perform that action at this time.
0 commit comments