1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Perform checks for propertis started with '\\0' only for dynamic properties

This commit is contained in:
Dmitry Stogov
2018-07-18 14:49:00 +03:00
parent 583616deb1
commit 412dd75e05

View File

@@ -364,13 +364,6 @@ static zend_always_inline uintptr_t zend_get_property_offset(zend_class_entry *c
return (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
}
if (UNEXPECTED(ZSTR_VAL(member)[0] == '\0' && ZSTR_LEN(member) != 0)) {
if (!silent) {
zend_throw_error(NULL, "Cannot access property started with '\\0'");
}
return ZEND_WRONG_PROPERTY_OFFSET;
}
if (UNEXPECTED(zend_hash_num_elements(&ce->properties_info) == 0)) {
goto exit_dynamic;
}
@@ -418,6 +411,12 @@ static zend_always_inline uintptr_t zend_get_property_offset(zend_class_entry *c
}
} else if (UNEXPECTED(property_info == NULL)) {
exit_dynamic:
if (UNEXPECTED(ZSTR_VAL(member)[0] == '\0' && ZSTR_LEN(member) != 0)) {
if (!silent) {
zend_throw_error(NULL, "Cannot access property started with '\\0'");
}
return ZEND_WRONG_PROPERTY_OFFSET;
}
if (cache_slot) {
CACHE_POLYMORPHIC_PTR_EX(cache_slot, ce, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
@@ -445,13 +444,6 @@ ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_s
uint32_t flags;
zend_class_entry *scope;
if (UNEXPECTED(ZSTR_VAL(member)[0] == '\0' && ZSTR_LEN(member) != 0)) {
if (!silent) {
zend_throw_error(NULL, "Cannot access property started with '\\0'");
}
return ZEND_WRONG_PROPERTY_INFO;
}
if (UNEXPECTED(zend_hash_num_elements(&ce->properties_info) == 0)) {
goto exit_dynamic;
}
@@ -495,6 +487,12 @@ ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_s
property_info = (zend_property_info*)Z_PTR_P(zv);
} else if (UNEXPECTED(property_info == NULL)) {
exit_dynamic:
if (UNEXPECTED(ZSTR_VAL(member)[0] == '\0' && ZSTR_LEN(member) != 0)) {
if (!silent) {
zend_throw_error(NULL, "Cannot access property started with '\\0'");
}
return ZEND_WRONG_PROPERTY_INFO;
}
return NULL;
} else if (UNEXPECTED(property_info == ZEND_WRONG_PROPERTY_INFO)) {
/* Information was available, but we were denied access. Error out. */