com php-src: Fixed bug #69805 (null ptr deref and seg fault in zend_resolve_class_name): NEWS Zend/tests/bug6 9805.phpt Zend/zend_compile.c

From: Date: Fri, 12 Jun 2015 13:07:23 +0000
Subject: com php-src: Fixed bug #69805 (null ptr deref and seg fault in zend_resolve_class_name): NEWS Zend/tests/bug6 9805.phpt Zend/zend_compile.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87235@lists.php.net to get a copy of this message
Commit: 49a8f801c737516f7912212779090628dec224e6 Author: Xinchen Hui <laruence@php.net> Fri, 12 Jun 2015 21:07:23 +0800 Parents: 1c754f0b71321861f8ecc723dbedfed8d4f23e69 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=49a8f801c737516f7912212779090628dec224e6 Log: Fixed bug #69805 (null ptr deref and seg fault in zend_resolve_class_name) Bugs: https://bugs.php.net/69805 Changed paths: M NEWS A Zend/tests/bug69805.phpt M Zend/zend_compile.c Diff: diff --git a/NEWS b/NEWS index ac4ba7c..77041ed 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS 25 Jun 2015, PHP 7.0.0 Alpha 2 - Core: + . Fixed bug #69805 (null ptr deref and seg fault in zend_resolve_class_name). + (Laruence) . Fixed bug #69551 (parse_ini_file() and parse_ini_string() segmentation fault). (Christoph M. Becker) . Fixed bug #69781 (phpinfo() reports Professional Editions of Windows diff --git a/Zend/tests/bug69805.phpt b/Zend/tests/bug69805.phpt new file mode 100644 index 0000000..c3ca62d --- /dev/null +++ b/Zend/tests/bug69805.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #69805 (null ptr deref and seg fault in zend_resolve_class_name) +--FILE-- +<?php +class p{public function c(){(0)::t;}}?> +?> +--EXPECTF-- +Fatal error: Illegal class name in %sbug69805.php on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 9be3748..902d37c 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -855,8 +855,11 @@ zend_string *zend_resolve_class_name(zend_string *name, uint32_t type) /* {{{ */ zend_string *zend_resolve_class_name_ast(zend_ast *ast) /* {{{ */ { - zend_string *name = zend_ast_get_str(ast); - return zend_resolve_class_name(name, ast->attr); + zval *class_name = zend_ast_get_zval(ast); + if (Z_TYPE_P(class_name) != IS_STRING) { + zend_error_noreturn(E_COMPILE_ERROR, "Illegal class name"); + } + return zend_resolve_class_name(Z_STR_P(class_name), ast->attr); } /* }}} */

« previous php.cvs (#87235) next »