mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix segfault when assigning to backing value by-ref from hook
Fixes oss-fuzz #391975641 Closes GH-17620
This commit is contained in:
parent
47a0922dee
commit
ab6977d36c
3 changed files with 25 additions and 1 deletions
2
NEWS
2
NEWS
|
@ -11,6 +11,8 @@ PHP NEWS
|
|||
. Fixed bug GH-17618 (UnhandledMatchError does not take
|
||||
zend.exception_ignore_args=1 into account). (timwolla)
|
||||
. Fix fallback paths in fast_long_{add,sub}_function. (nielsdos)
|
||||
. Fixed bug OSS-Fuzz #391975641 (Crash when accessing property backing value
|
||||
by reference). (ilutov)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug GH-17609 (Typo in error message: Dom\NO_DEFAULT_NS instead of
|
||||
|
|
22
Zend/tests/oss-fuzz-391975641.phpt
Normal file
22
Zend/tests/oss-fuzz-391975641.phpt
Normal file
|
@ -0,0 +1,22 @@
|
|||
--TEST--
|
||||
OSS-Fuzz #391975641: Segfault when creating reference from backing value
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public $prop {
|
||||
get => $this->prop;
|
||||
set {
|
||||
$this->prop = &$value;
|
||||
$value = &$this->prop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$c = new C;
|
||||
$c->prop = 1;
|
||||
var_dump($c->prop);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
|
@ -3490,7 +3490,7 @@ static zend_always_inline void zend_assign_to_property_reference(zval *container
|
|||
|
||||
variable_ptr = zend_wrong_assign_to_variable_reference(
|
||||
variable_ptr, value_ptr, &garbage OPLINE_CC EXECUTE_DATA_CC);
|
||||
} else if (prop_info) {
|
||||
} else if (prop_info && ZEND_TYPE_IS_SET(prop_info->type)) {
|
||||
variable_ptr = zend_assign_to_typed_property_reference(prop_info, variable_ptr, value_ptr, &garbage EXECUTE_DATA_CC);
|
||||
} else {
|
||||
zend_assign_to_variable_reference(variable_ptr, value_ptr, &garbage);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue