com php-src: Fixed bug #69905 (null ptr deref and segfault in ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER): Zend/tests/bug69905.phpt Zend/zend_execute
.c

From: Date: Tue, 23 Jun 2015 13:26:40 +0000
Subject: com php-src: Fixed bug #69905 (null ptr deref and segfault in ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER): Zend/tests/bug69905.phpt Zend/zend_execute
.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87458@lists.php.net to get a copy of this message
Commit: 7a01c44ab268820c2365798fde0fe010cf6c5e20 Author: Dmitry Stogov <dmitry@zend.com> Tue, 23 Jun 2015 16:26:40 +0300 Parents: 36d39b70443dcefeeb62d189ce67b414caf5486a Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7a01c44ab268820c2365798fde0fe010cf6c5e20 Log: Fixed bug #69905 (null ptr deref and segfault in ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER) Bugs: https://bugs.php.net/69905 Changed paths: A Zend/tests/bug69905.phpt M Zend/zend_execute.c Diff: diff --git a/Zend/tests/bug69905.phpt b/Zend/tests/bug69905.phpt new file mode 100644 index 0000000..fb25341 --- /dev/null +++ b/Zend/tests/bug69905.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #69905 (null ptr deref and segfault in ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER) +--FILE-- +<?php +md5(0)[]--; +?> +--EXPECTF-- +Fatal error: Uncaught Error: [] operator not supported for strings in %sbug69905.php:2 +Stack trace: +#0 {main} + thrown in %sbug69905.php on line 2 diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 246372f..8fc4024 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1682,11 +1682,11 @@ convert_to_array: if (dim == NULL) { zend_error(E_EXCEPTION | E_ERROR, "[] operator not supported for strings"); + ZVAL_NULL(result); } else { zend_check_string_offset(dim, type); + ZVAL_INDIRECT(result, NULL); /* wrong string offset */ } - - ZVAL_INDIRECT(result, NULL); /* wrong string offset */ } else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) { if (!Z_OBJ_HT_P(container)->read_dimension) { zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");

« previous php.cvs (#87458) next »