com php-src: Fixed bug #72162 (use-after-free - error_reporti ng): NEWS Zend/tests/bug72162.phpt Zend/z end_builtin_functions.c

From: Date: Thu, 05 May 2016 03:02:21 +0000
Subject: com php-src: Fixed bug #72162 (use-after-free - error_reporti ng): NEWS Zend/tests/bug72162.phpt Zend/z end_builtin_functions.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-92025@lists.php.net to get a copy of this message
Commit: 9191862121411858036b0d2a06c3a99229c8bd24 Author: Xinchen Hui <laruence@gmail.com> Thu, 5 May 2016 11:02:21 +0800 Parents: 0691e7a8e15ace3ce186ceb8c27753325a5a956f Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9191862121411858036b0d2a06c3a99229c8bd24 Log: Fixed bug #72162 (use-after-free - error_reporting) Bugs: https://bugs.php.net/72162 Changed paths: M NEWS A Zend/tests/bug72162.phpt M Zend/zend_builtin_functions.c Diff: diff --git a/NEWS b/NEWS index 8da8588..fcb4a8d 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ PHP NEWS ?? ??? 2016 PHP 7.0.7 - Core: + . Fixed bug #72162 (use-after-free - error_reporting). (Laruence) . Add compiler option to disable special case function calls. (Joe) . Fixed bug #72101 (crash on complex code). (Dmitry) . Fixed bug #72100 (implode() inserts garbage into resulting string when diff --git a/Zend/tests/bug72162.phpt b/Zend/tests/bug72162.phpt new file mode 100644 index 0000000..3cd12de --- /dev/null +++ b/Zend/tests/bug72162.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #72162 (use-after-free - error_reporting) +--FILE-- +<?php +error_reporting(1); +$var11 = new StdClass(); +$var16 = error_reporting($var11); +?> +okey +--EXPECT-- +okey diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index a576455..558a1b2 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -704,7 +704,8 @@ ZEND_FUNCTION(error_reporting) #endif old_error_reporting = EG(error_reporting); - if(ZEND_NUM_ARGS() != 0) { + if (ZEND_NUM_ARGS() != 0) { + zend_string *new_val = zval_get_string(err); do { zend_ini_entry *p = EG(error_reporting_ini_entry); @@ -730,7 +731,7 @@ ZEND_FUNCTION(error_reporting) zend_string_release(p->value); } - p->value = zval_get_string(err); + p->value = new_val; if (Z_TYPE_P(err) == IS_LONG) { EG(error_reporting) = Z_LVAL_P(err); } else {

« previous php.cvs (#92025) next »