cvs: ZendEngine2(PHP_5_2) / zend.c zend_builtin_functions.c zend_compile.c zend_compile.h zend_object_handlers.c zend_object_handlers.h zend_vm_def.h
zend_vm_execute.h
| From: | Marcus Boerger | Date: | Mon, 24 Jul 2006 17:58:34 +0000 |
| Subject: | cvs: ZendEngine2(PHP_5_2) / zend.c zend_builtin_functions.c zend_compile.c zend_compile.h zend_object_handlers.c zend_object_handlers.h zend_vm_def.h zend_vm_execute.h |
||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5124@lists.php.net to get a copy of this message | ||
helly Mon Jul 24 17:58:34 2006 UTC
Modified files: (Branch: PHP_5_2)
/ZendEngine2 zend.c zend_builtin_functions.c zend_compile.c
zend_compile.h zend_object_handlers.c
zend_object_handlers.h zend_vm_def.h zend_vm_execute.h
Log:
- Better fix for #34505 and related, drop zend_unmangle_property_name_ex()
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend.c?r1=1.308.2.12.2.15&r2=1.308.2.12.2.16&diff_format=u Index: ZendEngine2/zend.c diff -u ZendEngine2/zend.c:1.308.2.12.2.15 ZendEngine2/zend.c:1.308.2.12.2.16 --- ZendEngine2/zend.c:1.308.2.12.2.15 Wed Jul 19 06:32:52 2006 +++ ZendEngine2/zend.c Mon Jul 24 17:58:32 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.c,v 1.308.2.12.2.15 2006/07/19 06:32:52 tony2001 Exp $ */ +/* $Id: zend.c,v 1.308.2.12.2.16 2006/07/24 17:58:32 helly Exp $ */ #include "zend.h" #include "zend_extensions.h" @@ -131,7 +131,7 @@ if (is_object) { char *prop_name, *class_name; - zend_unmangle_property_name_ex(string_key, str_len, &class_name, &prop_name); + zend_unmangle_property_name(string_key, str_len-1, &class_name, &prop_name); ZEND_PUTS_EX(prop_name); if (class_name) { if (class_name[0]=='*') { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.277.2.12.2.5&r2=1.277.2.12.2.6&diff_format=u Index: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.5 ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.6 --- ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.5 Thu Jul 20 07:30:22 2006 +++ ZendEngine2/zend_builtin_functions.c Mon Jul 24 17:58:32 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.5 2006/07/20 07:30:22 tony2001 Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.6 2006/07/24 17:58:32 helly Exp $ */ #include "zend.h" #include "zend_API.h" @@ -723,7 +723,7 @@ zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos); zend_hash_move_forward_ex(properties, &pos); - zend_unmangle_property_name_ex(key, key_len, &class_name, &prop_name); + zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name); if (class_name) { if (class_name[0] != '*' && strcmp(class_name, ce->name)) { /* filter privates from base classes */ @@ -820,7 +820,7 @@ (*value)->refcount++; add_assoc_zval_ex(return_value, key, key_len, *value); } else if (instanceof) { - zend_unmangle_property_name_ex(key, key_len, &class_name, &prop_name); + zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name); if (!memcmp(class_name, "*", 2) || (Z_OBJCE_P(EG(This)) == Z_OBJCE_PP(obj) && !strcmp(Z_OBJCE_P(EG(This))->name, class_name))) { /* Not separating references */ (*value)->refcount++; @@ -969,7 +969,7 @@ if (property_info->flags & ZEND_ACC_PUBLIC) { RETURN_TRUE; } - zend_unmangle_property_name_ex(property_info->name, property_info->name_length, &class_name, &prop_name); + zend_unmangle_property_name(property_info->name, property_info->name_length, &class_name, &prop_name); if (!strncmp(class_name, "*", 1)) { if (instanceof_function(EG(scope), ce TSRMLS_CC)) { RETURN_TRUE; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.14&r2=1.647.2.27.2.15&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.14 ZendEngine2/zend_compile.c:1.647.2.27.2.15 --- ZendEngine2/zend_compile.c:1.647.2.27.2.14 Tue Jul 18 09:06:32 2006 +++ ZendEngine2/zend_compile.c Mon Jul 24 17:58:32 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.14 2006/07/18 09:06:32 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.15 2006/07/24 17:58:32 helly Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -2116,7 +2116,7 @@ if (zend_hash_find(&ce->default_static_members, child_info->name, child_info->name_length+1, (void**)&new_prop) == SUCCESS) { if (Z_TYPE_PP(new_prop) != IS_NULL && Z_TYPE_PP(prop) != IS_NULL) { char *prop_name, *tmp; - zend_unmangle_property_name_ex(child_info->name, child_info->name_length, &tmp, &prop_name); + zend_unmangle_property_name(child_info->name, child_info->name_length, &tmp, &prop_name); zend_error(E_COMPILE_ERROR, "Cannot change initial value of property static protected %s::$%s in class %s", parent_ce->name, prop_name, ce->name); @@ -2901,29 +2901,38 @@ } -ZEND_API void zend_unmangle_property_name_ex(char *mangled_property, int mangled_property_len, char **class_name, char **prop_name) +static int zend_strnlen(const char* s, int maxlen) { - *prop_name = *class_name = NULL; - - if (mangled_property_len < 2) { /* do not try to unmangle empty strings */ - *prop_name = mangled_property; - return; - } - - zend_unmangle_property_name(mangled_property, class_name, prop_name); + int len = 0; + while (*s++ && maxlen--) len++; + return len; } -ZEND_API void zend_unmangle_property_name(char *mangled_property, char **class_name, char **prop_name) +ZEND_API int zend_unmangle_property_name(char *mangled_property, int len, char **class_name, char **prop_name) { - *prop_name = *class_name = NULL; + int class_name_len; + + *class_name = NULL; if (mangled_property[0]!=0) { *prop_name = mangled_property; - return; + return SUCCESS; + } + if (len < 3) { + zend_error(E_NOTICE, "Illegal member variable name"); + *prop_name = mangled_property; + return FAILURE; } + class_name_len = zend_strnlen(mangled_property+1, --len - 1) + 1; + if (class_name_len >= len || mangled_property[class_name_len]!=0) { + zend_error(E_NOTICE, "Corrupt member variable name"); + *prop_name = mangled_property; + return FAILURE; + } *class_name = mangled_property+1; - *prop_name = (*class_name)+strlen(*class_name)+1; + *prop_name = (*class_name)+class_name_len; + return SUCCESS; } void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_type TSRMLS_DC) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.h?r1=1.316.2.8.2.4&r2=1.316.2.8.2.5&diff_format=u Index: ZendEngine2/zend_compile.h diff -u ZendEngine2/zend_compile.h:1.316.2.8.2.4 ZendEngine2/zend_compile.h:1.316.2.8.2.5 --- ZendEngine2/zend_compile.h:1.316.2.8.2.4 Tue Jun 13 12:57:48 2006 +++ ZendEngine2/zend_compile.h Mon Jul 24 17:58:32 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.h,v 1.316.2.8.2.4 2006/06/13 12:57:48 sesser Exp $ */ +/* $Id: zend_compile.h,v 1.316.2.8.2.5 2006/07/24 17:58:32 helly Exp $ */ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H @@ -528,8 +528,7 @@ void zend_class_add_ref(zend_class_entry **ce); ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal); -ZEND_API void zend_unmangle_property_name(char *mangled_property, char **prop_name, char **class_name); -ZEND_API void zend_unmangle_property_name_ex(char *mangled_property, int mangled_property_len, char **prop_name, char **class_name); +ZEND_API int zend_unmangle_property_name(char *mangled_property, int mangled_property_len, char **prop_name, char **class_name); #define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor #define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_object_handlers.c?r1=1.135.2.6.2.9&r2=1.135.2.6.2.10&diff_format=u Index: ZendEngine2/zend_object_handlers.c diff -u ZendEngine2/zend_object_handlers.c:1.135.2.6.2.9 ZendEngine2/zend_object_handlers.c:1.135.2.6.2.10 --- ZendEngine2/zend_object_handlers.c:1.135.2.6.2.9 Fri Jul 21 10:32:17 2006 +++ ZendEngine2/zend_object_handlers.c Mon Jul 24 17:58:32 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.c,v 1.135.2.6.2.9 2006/07/21 10:32:17 dmitry Exp $ */ +/* $Id: zend_object_handlers.c,v 1.135.2.6.2.10 2006/07/24 17:58:32 helly Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -245,13 +245,13 @@ } -ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name TSRMLS_DC) +ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name, int prop_info_name_len TSRMLS_DC) { zend_property_info *property_info; char *class_name, *prop_name; zval member; - zend_unmangle_property_name(prop_info_name, &class_name, &prop_name); + zend_unmangle_property_name(prop_info_name, prop_info_name_len, &class_name, &prop_name); ZVAL_STRING(&member, prop_name, 0); property_info = zend_get_property_info(zobj->ce, &member, 1 TSRMLS_CC); if (!property_info) { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_object_handlers.h?r1=1.47.2.2.2.3&r2=1.47.2.2.2.4&diff_format=u Index: ZendEngine2/zend_object_handlers.h diff -u ZendEngine2/zend_object_handlers.h:1.47.2.2.2.3 ZendEngine2/zend_object_handlers.h:1.47.2.2.2.4 --- ZendEngine2/zend_object_handlers.h:1.47.2.2.2.3 Wed Jul 5 11:41:25 2006 +++ ZendEngine2/zend_object_handlers.h Mon Jul 24 17:58:32 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.h,v 1.47.2.2.2.3 2006/07/05 11:41:25 tony2001 Exp $ */ +/* $Id: zend_object_handlers.h,v 1.47.2.2.2.4 2006/07/24 17:58:32 helly Exp $ */ #ifndef ZEND_OBJECT_HANDLERS_H #define ZEND_OBJECT_HANDLERS_H @@ -153,7 +153,7 @@ ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope); -ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name TSRMLS_DC); +ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name, int prop_info_name_len TSRMLS_DC); ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS); END_EXTERN_C() http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.59.2.29.2.15&r2=1.59.2.29.2.16&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.59.2.29.2.15 ZendEngine2/zend_vm_def.h:1.59.2.29.2.16 --- ZendEngine2/zend_vm_def.h:1.59.2.29.2.15 Fri Jul 21 08:39:30 2006 +++ ZendEngine2/zend_vm_def.h Mon Jul 24 17:58:32 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.59.2.29.2.15 2006/07/21 08:39:30 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.59.2.29.2.16 2006/07/24 17:58:32 helly Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -3155,7 +3155,7 @@ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); if (key_type != HASH_KEY_NON_EXISTANT && - zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { + zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS) { break; } zend_hash_move_forward(fe_ht); @@ -3214,9 +3214,9 @@ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); zend_hash_move_forward(fe_ht); - } while (key_type == HASH_KEY_NON_EXISTANT || zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS); + } while (key_type == HASH_KEY_NON_EXISTANT || zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) != SUCCESS); if (use_key) { - zend_unmangle_property_name_ex(str_key, str_key_len, &class_name, &prop_name); + zend_unmangle_property_name(str_key, str_key_len-1, &class_name, &prop_name); str_key_len = strlen(prop_name); str_key = estrndup(prop_name, str_key_len); str_key_len++; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.62.2.30.2.15&r2=1.62.2.30.2.16&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.62.2.30.2.15 ZendEngine2/zend_vm_execute.h:1.62.2.30.2.16 --- ZendEngine2/zend_vm_execute.h:1.62.2.30.2.15 Fri Jul 21 08:39:30 2006 +++ ZendEngine2/zend_vm_execute.h Mon Jul 24 17:58:32 2006 @@ -2195,7 +2195,7 @@ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); if (key_type != HASH_KEY_NON_EXISTANT && - zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { + zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS) { break; } zend_hash_move_forward(fe_ht); @@ -4705,7 +4705,7 @@ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); if (key_type != HASH_KEY_NON_EXISTANT && - zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { + zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS) { break; } zend_hash_move_forward(fe_ht); @@ -7797,7 +7797,7 @@ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); if (key_type != HASH_KEY_NON_EXISTANT && - zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { + zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS) { break; } zend_hash_move_forward(fe_ht); @@ -7856,9 +7856,9 @@ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); zend_hash_move_forward(fe_ht); - } while (key_type == HASH_KEY_NON_EXISTANT || zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS); + } while (key_type == HASH_KEY_NON_EXISTANT || zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) != SUCCESS); if (use_key) { - zend_unmangle_property_name_ex(str_key, str_key_len, &class_name, &prop_name); + zend_unmangle_property_name(str_key, str_key_len-1, &class_name, &prop_name); str_key_len = strlen(prop_name); str_key = estrndup(prop_name, str_key_len); str_key_len++; @@ -20249,7 +20249,7 @@ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); if (key_type != HASH_KEY_NON_EXISTANT && - zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { + zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS) { break; } zend_hash_move_forward(fe_ht);
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend.c?r1=1.308.2.12.2.15&r2=1.308.2.12.2.16&diff_format=u Index: ZendEngine2/zend.c diff -u ZendEngine2/zend.c:1.308.2.12.2.15 ZendEngine2/zend.c:1.308.2.12.2.16 --- ZendEngine2/zend.c:1.308.2.12.2.15 Wed Jul 19 06:32:52 2006 +++ ZendEngine2/zend.c Mon Jul 24 17:58:32 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.c,v 1.308.2.12.2.15 2006/07/19 06:32:52 tony2001 Exp $ */ +/* $Id: zend.c,v 1.308.2.12.2.16 2006/07/24 17:58:32 helly Exp $ */ #include "zend.h" #include "zend_extensions.h" @@ -131,7 +131,7 @@ if (is_object) { char *prop_name, *class_name; - zend_unmangle_property_name_ex(string_key, str_len, &class_name, &prop_name); + zend_unmangle_property_name(string_key, str_len-1, &class_name, &prop_name); ZEND_PUTS_EX(prop_name); if (class_name) { if (class_name[0]=='*') { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.277.2.12.2.5&r2=1.277.2.12.2.6&diff_format=u Index: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.5 ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.6 --- ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.5 Thu Jul 20 07:30:22 2006 +++ ZendEngine2/zend_builtin_functions.c Mon Jul 24 17:58:32 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.5 2006/07/20 07:30:22 tony2001 Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.6 2006/07/24 17:58:32 helly Exp $ */ #include "zend.h" #include "zend_API.h" @@ -723,7 +723,7 @@ zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos); zend_hash_move_forward_ex(properties, &pos); - zend_unmangle_property_name_ex(key, key_len, &class_name, &prop_name); + zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name); if (class_name) { if (class_name[0] != '*' && strcmp(class_name, ce->name)) { /* filter privates from base classes */ @@ -820,7 +820,7 @@ (*value)->refcount++; add_assoc_zval_ex(return_value, key, key_len, *value); } else if (instanceof) { - zend_unmangle_property_name_ex(key, key_len, &class_name, &prop_name); + zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name); if (!memcmp(class_name, "*", 2) || (Z_OBJCE_P(EG(This)) == Z_OBJCE_PP(obj) && !strcmp(Z_OBJCE_P(EG(This))->name, class_name))) { /* Not separating references */ (*value)->refcount++; @@ -969,7 +969,7 @@ if (property_info->flags & ZEND_ACC_PUBLIC) { RETURN_TRUE; } - zend_unmangle_property_name_ex(property_info->name, property_info->name_length, &class_name, &prop_name); + zend_unmangle_property_name(property_info->name, property_info->name_length, &class_name, &prop_name); if (!strncmp(class_name, "*", 1)) { if (instanceof_function(EG(scope), ce TSRMLS_CC)) { RETURN_TRUE; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.14&r2=1.647.2.27.2.15&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.14 ZendEngine2/zend_compile.c:1.647.2.27.2.15 --- ZendEngine2/zend_compile.c:1.647.2.27.2.14 Tue Jul 18 09:06:32 2006 +++ ZendEngine2/zend_compile.c Mon Jul 24 17:58:32 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.14 2006/07/18 09:06:32 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.15 2006/07/24 17:58:32 helly Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -2116,7 +2116,7 @@ if (zend_hash_find(&ce->default_static_members, child_info->name, child_info->name_length+1, (void**)&new_prop) == SUCCESS) { if (Z_TYPE_PP(new_prop) != IS_NULL && Z_TYPE_PP(prop) != IS_NULL) { char *prop_name, *tmp; - zend_unmangle_property_name_ex(child_info->name, child_info->name_length, &tmp, &prop_name); + zend_unmangle_property_name(child_info->name, child_info->name_length, &tmp, &prop_name); zend_error(E_COMPILE_ERROR, "Cannot change initial value of property static protected %s::$%s in class %s", parent_ce->name, prop_name, ce->name); @@ -2901,29 +2901,38 @@ } -ZEND_API void zend_unmangle_property_name_ex(char *mangled_property, int mangled_property_len, char **class_name, char **prop_name) +static int zend_strnlen(const char* s, int maxlen) { - *prop_name = *class_name = NULL; - - if (mangled_property_len < 2) { /* do not try to unmangle empty strings */ - *prop_name = mangled_property; - return; - } - - zend_unmangle_property_name(mangled_property, class_name, prop_name); + int len = 0; + while (*s++ && maxlen--) len++; + return len; } -ZEND_API void zend_unmangle_property_name(char *mangled_property, char **class_name, char **prop_name) +ZEND_API int zend_unmangle_property_name(char *mangled_property, int len, char **class_name, char **prop_name) { - *prop_name = *class_name = NULL; + int class_name_len; + + *class_name = NULL; if (mangled_property[0]!=0) { *prop_name = mangled_property; - return; + return SUCCESS; + } + if (len < 3) { + zend_error(E_NOTICE, "Illegal member variable name"); + *prop_name = mangled_property; + return FAILURE; } + class_name_len = zend_strnlen(mangled_property+1, --len - 1) + 1; + if (class_name_len >= len || mangled_property[class_name_len]!=0) { + zend_error(E_NOTICE, "Corrupt member variable name"); + *prop_name = mangled_property; + return FAILURE; + } *class_name = mangled_property+1; - *prop_name = (*class_name)+strlen(*class_name)+1; + *prop_name = (*class_name)+class_name_len; + return SUCCESS; } void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_type TSRMLS_DC) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.h?r1=1.316.2.8.2.4&r2=1.316.2.8.2.5&diff_format=u Index: ZendEngine2/zend_compile.h diff -u ZendEngine2/zend_compile.h:1.316.2.8.2.4 ZendEngine2/zend_compile.h:1.316.2.8.2.5 --- ZendEngine2/zend_compile.h:1.316.2.8.2.4 Tue Jun 13 12:57:48 2006 +++ ZendEngine2/zend_compile.h Mon Jul 24 17:58:32 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.h,v 1.316.2.8.2.4 2006/06/13 12:57:48 sesser Exp $ */ +/* $Id: zend_compile.h,v 1.316.2.8.2.5 2006/07/24 17:58:32 helly Exp $ */ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H @@ -528,8 +528,7 @@ void zend_class_add_ref(zend_class_entry **ce); ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal); -ZEND_API void zend_unmangle_property_name(char *mangled_property, char **prop_name, char **class_name); -ZEND_API void zend_unmangle_property_name_ex(char *mangled_property, int mangled_property_len, char **prop_name, char **class_name); +ZEND_API int zend_unmangle_property_name(char *mangled_property, int mangled_property_len, char **prop_name, char **class_name); #define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor #define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_object_handlers.c?r1=1.135.2.6.2.9&r2=1.135.2.6.2.10&diff_format=u Index: ZendEngine2/zend_object_handlers.c diff -u ZendEngine2/zend_object_handlers.c:1.135.2.6.2.9 ZendEngine2/zend_object_handlers.c:1.135.2.6.2.10 --- ZendEngine2/zend_object_handlers.c:1.135.2.6.2.9 Fri Jul 21 10:32:17 2006 +++ ZendEngine2/zend_object_handlers.c Mon Jul 24 17:58:32 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.c,v 1.135.2.6.2.9 2006/07/21 10:32:17 dmitry Exp $ */ +/* $Id: zend_object_handlers.c,v 1.135.2.6.2.10 2006/07/24 17:58:32 helly Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -245,13 +245,13 @@ } -ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name TSRMLS_DC) +ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name, int prop_info_name_len TSRMLS_DC) { zend_property_info *property_info; char *class_name, *prop_name; zval member; - zend_unmangle_property_name(prop_info_name, &class_name, &prop_name); + zend_unmangle_property_name(prop_info_name, prop_info_name_len, &class_name, &prop_name); ZVAL_STRING(&member, prop_name, 0); property_info = zend_get_property_info(zobj->ce, &member, 1 TSRMLS_CC); if (!property_info) { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_object_handlers.h?r1=1.47.2.2.2.3&r2=1.47.2.2.2.4&diff_format=u Index: ZendEngine2/zend_object_handlers.h diff -u ZendEngine2/zend_object_handlers.h:1.47.2.2.2.3 ZendEngine2/zend_object_handlers.h:1.47.2.2.2.4 --- ZendEngine2/zend_object_handlers.h:1.47.2.2.2.3 Wed Jul 5 11:41:25 2006 +++ ZendEngine2/zend_object_handlers.h Mon Jul 24 17:58:32 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.h,v 1.47.2.2.2.3 2006/07/05 11:41:25 tony2001 Exp $ */ +/* $Id: zend_object_handlers.h,v 1.47.2.2.2.4 2006/07/24 17:58:32 helly Exp $ */ #ifndef ZEND_OBJECT_HANDLERS_H #define ZEND_OBJECT_HANDLERS_H @@ -153,7 +153,7 @@ ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope); -ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name TSRMLS_DC); +ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name, int prop_info_name_len TSRMLS_DC); ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS); END_EXTERN_C() http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.59.2.29.2.15&r2=1.59.2.29.2.16&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.59.2.29.2.15 ZendEngine2/zend_vm_def.h:1.59.2.29.2.16 --- ZendEngine2/zend_vm_def.h:1.59.2.29.2.15 Fri Jul 21 08:39:30 2006 +++ ZendEngine2/zend_vm_def.h Mon Jul 24 17:58:32 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.59.2.29.2.15 2006/07/21 08:39:30 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.59.2.29.2.16 2006/07/24 17:58:32 helly Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -3155,7 +3155,7 @@ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); if (key_type != HASH_KEY_NON_EXISTANT && - zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { + zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS) { break; } zend_hash_move_forward(fe_ht); @@ -3214,9 +3214,9 @@ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); zend_hash_move_forward(fe_ht); - } while (key_type == HASH_KEY_NON_EXISTANT || zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS); + } while (key_type == HASH_KEY_NON_EXISTANT || zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) != SUCCESS); if (use_key) { - zend_unmangle_property_name_ex(str_key, str_key_len, &class_name, &prop_name); + zend_unmangle_property_name(str_key, str_key_len-1, &class_name, &prop_name); str_key_len = strlen(prop_name); str_key = estrndup(prop_name, str_key_len); str_key_len++; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.62.2.30.2.15&r2=1.62.2.30.2.16&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.62.2.30.2.15 ZendEngine2/zend_vm_execute.h:1.62.2.30.2.16 --- ZendEngine2/zend_vm_execute.h:1.62.2.30.2.15 Fri Jul 21 08:39:30 2006 +++ ZendEngine2/zend_vm_execute.h Mon Jul 24 17:58:32 2006 @@ -2195,7 +2195,7 @@ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); if (key_type != HASH_KEY_NON_EXISTANT && - zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { + zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS) { break; } zend_hash_move_forward(fe_ht); @@ -4705,7 +4705,7 @@ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); if (key_type != HASH_KEY_NON_EXISTANT && - zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { + zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS) { break; } zend_hash_move_forward(fe_ht); @@ -7797,7 +7797,7 @@ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); if (key_type != HASH_KEY_NON_EXISTANT && - zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { + zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS) { break; } zend_hash_move_forward(fe_ht); @@ -7856,9 +7856,9 @@ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); zend_hash_move_forward(fe_ht); - } while (key_type == HASH_KEY_NON_EXISTANT || zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS); + } while (key_type == HASH_KEY_NON_EXISTANT || zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) != SUCCESS); if (use_key) { - zend_unmangle_property_name_ex(str_key, str_key_len, &class_name, &prop_name); + zend_unmangle_property_name(str_key, str_key_len-1, &class_name, &prop_name); str_key_len = strlen(prop_name); str_key = estrndup(prop_name, str_key_len); str_key_len++; @@ -20249,7 +20249,7 @@ key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL); if (key_type != HASH_KEY_NON_EXISTANT && - zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS) { + zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS) { break; } zend_hash_move_forward(fe_ht);