File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ OSS-Fuzz #403816122: Segfault when initializing default properties of child prop with added hooks
3
+ --FILE--
4
+ <?php
5
+
6
+ const X = 'x ' ;
7
+
8
+ class P {
9
+ public $ prop ;
10
+ }
11
+
12
+ class C extends P {
13
+ public $ prop = X {
14
+ get => 'y ' ;
15
+ }
16
+ }
17
+
18
+ var_dump ((new C )->prop );
19
+
20
+ ?>
21
+ --EXPECT--
22
+ string(1) "y"
Original file line number Diff line number Diff line change @@ -1613,8 +1613,12 @@ ZEND_API zend_result zend_update_class_constants(zend_class_entry *class_type) /
1613
1613
/* Use the default properties table to also update initializers of private properties
1614
1614
* that have been shadowed in a child class. */
1615
1615
for (uint32_t i = 0 ; i < class_type -> default_properties_count ; i ++ ) {
1616
- val = & default_properties_table [i ];
1617
1616
prop_info = class_type -> properties_info_table [i ];
1617
+ if (!prop_info ) {
1618
+ continue ;
1619
+ }
1620
+
1621
+ val = & default_properties_table [OBJ_PROP_TO_NUM (prop_info -> offset )];
1618
1622
if (Z_TYPE_P (val ) == IS_CONSTANT_AST
1619
1623
&& UNEXPECTED (update_property (val , prop_info ) != SUCCESS )) {
1620
1624
return FAILURE ;
You can’t perform that action at this time.
0 commit comments