- Fixed bug #47572 (zval_update_constant_ex: Segmentation fault)

This commit is contained in:
Felipe Pena 2009-03-05 16:24:41 +00:00
parent d81acb4403
commit fadd129268
2 changed files with 23 additions and 2 deletions

17
Zend/tests/bug47572.phpt Normal file
View File

@ -0,0 +1,17 @@
--TEST--
Bug #47572 (zval_update_constant_ex: Segmentation fault)
--FILE--
<?php
class Foo {
public static $bar = array(
FOO => "bar"
);
}
$foo = new Foo();
?>
--EXPECTF--
Notice: Use of undefined constant FOO - assumed 'FOO' in %s on line %d

View File

@ -655,10 +655,12 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
str_index.u = colon.u + 1;
} else {
if (str_index.u[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) {
actual = (UChar *)u_memrchr(str_index.u, '\\', str_index_len - 3) + 1;
if ((actual = (UChar *)u_memrchr(str_index.u, '\\', str_index_len - 3))) {
actual++;
str_index_len -= (actual - str_index.u);
str_index.u = actual;
}
}
if (str_index.u[0] == '\\') {
++str_index.u;
--str_index_len;
@ -678,10 +680,12 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
str_index.s = colon.s + 1;
} else {
if (str_index.s[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) {
actual = (char *)zend_memrchr(str_index.s, '\\', str_index_len - 3) + 1;
if ((actual = (char *)zend_memrchr(str_index.s, '\\', str_index_len - 3))) {
actual++;
str_index_len -= (actual - str_index.s);
str_index.s = actual;
}
}
if (str_index.s[0] == '\\') {
++str_index.s;
--str_index_len;