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
23 changes: 23 additions & 0 deletions Zend/tests/oss-fuzz-478009707.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
OSS-Fuzz #478009707: Assign-op/inc/dec on untyped hooked property backing value
--FILE--
<?php

class C {
public $prop {
set {
$this->prop = $value;
$this->prop += 1;
$this->prop++;
++$this->prop;
}
}
}

$c = new C(1);
$c->prop = 1;
var_dump($c->prop);

?>
--EXPECT--
int(4)
8 changes: 5 additions & 3 deletions Zend/zend_vm_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ ZEND_VM_C_LABEL(assign_op_object):
}

prop_info = (zend_property_info*)CACHED_PTR_EX(cache_slot + 2);
if (prop_info) {
if (prop_info && ZEND_TYPE_IS_SET(prop_info->type)) {
/* special case for typed properties */
zend_binary_assign_op_typed_prop(prop_info, zptr, value OPLINE_CC EXECUTE_DATA_CC);
} else {
Expand Down Expand Up @@ -1326,7 +1326,8 @@ ZEND_VM_C_LABEL(pre_incdec_object):
}
} else {
prop_info = (zend_property_info *) CACHED_PTR_EX(cache_slot + 2);
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
zend_pre_incdec_property_zval(zptr,
prop_info && ZEND_TYPE_IS_SET(prop_info->type) ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
}
} else {
zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
Expand Down Expand Up @@ -1394,7 +1395,8 @@ ZEND_VM_C_LABEL(post_incdec_object):
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
prop_info = (zend_property_info*)CACHED_PTR_EX(cache_slot + 2);
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
zend_post_incdec_property_zval(zptr,
prop_info && ZEND_TYPE_IS_SET(prop_info->type) ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
}
} else {
zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
Expand Down
72 changes: 45 additions & 27 deletions Zend/zend_vm_execute.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading