summaryrefslogtreecommitdiff
path: root/Zend/zend_inheritance.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-02-15 14:43:55 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-02-15 14:43:55 +0100
commitf39e821c7e3f0fda3bb5a266153e6a0fde944a97 (patch)
treee6160f546d54b2abe80ef1fcdc4e3893660dee99 /Zend/zend_inheritance.c
parent27d9800b1d9d37bc6eacb1000cf63f3f1237b742 (diff)
parente6e9bea25798068ff3c9135515e5d000fe70a43b (diff)
downloadphp-git-f39e821c7e3f0fda3bb5a266153e6a0fde944a97.tar.gz
Merge branch 'PHP-7.4'
Diffstat (limited to 'Zend/zend_inheritance.c')
-rw-r--r--Zend/zend_inheritance.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 5ffc0b6520..b0770e2068 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -855,19 +855,22 @@ static void do_inherit_class_constant(zend_string *name, zend_class_constant *pa
void zend_build_properties_info_table(zend_class_entry *ce)
{
zend_property_info **table, *prop;
+ size_t size;
if (ce->default_properties_count == 0) {
return;
}
ZEND_ASSERT(ce->properties_info_table == NULL);
+ size = sizeof(zend_property_info *) * ce->default_properties_count;
if (ce->type == ZEND_USER_CLASS) {
- ce->properties_info_table = table = zend_arena_alloc(&CG(arena),
- sizeof(zend_property_info *) * ce->default_properties_count);
+ ce->properties_info_table = table = zend_arena_alloc(&CG(arena), size);
} else {
- ce->properties_info_table = table = pemalloc(
- sizeof(zend_property_info *) * ce->default_properties_count, 1);
+ ce->properties_info_table = table = pemalloc(size, 1);
}
+ /* Dead slots may be left behind during inheritance. Make sure these are NULLed out. */
+ memset(table, 0, size);
+
if (ce->parent && ce->parent->default_properties_count != 0) {
zend_property_info **parent_table = ce->parent->properties_info_table;
memcpy(