Skip to content

Commit 49a8f80

Browse files
committed
Fixed bug #69805 (null ptr deref and seg fault in zend_resolve_class_name)
1 parent 1c754f0 commit 49a8f80

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ PHP NEWS
33
25 Jun 2015, PHP 7.0.0 Alpha 2
44

55
- Core:
6+
. Fixed bug #69805 (null ptr deref and seg fault in zend_resolve_class_name).
7+
(Laruence)
68
. Fixed bug #69551 (parse_ini_file() and parse_ini_string() segmentation
79
fault). (Christoph M. Becker)
810
. Fixed bug #69781 (phpinfo() reports Professional Editions of Windows

Zend/tests/bug69805.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--TEST--
2+
Bug #69805 (null ptr deref and seg fault in zend_resolve_class_name)
3+
--FILE--
4+
<?php
5+
class p{public function c(){(0)::t;}}?>
6+
?>
7+
--EXPECTF--
8+
Fatal error: Illegal class name in %sbug69805.php on line %d

Zend/zend_compile.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,8 +855,11 @@ zend_string *zend_resolve_class_name(zend_string *name, uint32_t type) /* {{{ */
855855

856856
zend_string *zend_resolve_class_name_ast(zend_ast *ast) /* {{{ */
857857
{
858-
zend_string *name = zend_ast_get_str(ast);
859-
return zend_resolve_class_name(name, ast->attr);
858+
zval *class_name = zend_ast_get_zval(ast);
859+
if (Z_TYPE_P(class_name) != IS_STRING) {
860+
zend_error_noreturn(E_COMPILE_ERROR, "Illegal class name");
861+
}
862+
return zend_resolve_class_name(Z_STR_P(class_name), ast->attr);
860863
}
861864
/* }}} */
862865

0 commit comments

Comments
 (0)