Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Zend/tests/oss-fuzz-474613951.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
OSS-Fuzz #474613951: Leaked parent property default value
--FILE--
<?php

class A {
public $prop = C { get => $this->prop; }
}

class B extends A {
public $prop { get => 42; }
}

?>
===DONE===
--EXPECT--
===DONE===
5 changes: 2 additions & 3 deletions Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -1495,10 +1495,9 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke
}

int parent_num = OBJ_PROP_TO_NUM(parent_info->offset);
/* Don't keep default properties in GC (they may be freed by opcache) */
zval_ptr_dtor_nogc(&(ce->default_properties_table[parent_num]));
if (child_info->offset != ZEND_VIRTUAL_PROPERTY_OFFSET) {
/* Don't keep default properties in GC (they may be freed by opcache) */
zval_ptr_dtor_nogc(&(ce->default_properties_table[parent_num]));

if (use_child_prop) {
ZVAL_UNDEF(&ce->default_properties_table[parent_num]);
} else {
Expand Down
Loading