mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Fix failed assertion with throwing __toString in binary const expr
Solve this with the same pattern as ZEND_AST_GREATER[_EQUAL]. Fixes OSS-Fuzz #434346548 Closes GH-19291
This commit is contained in:
parent
be9f1d3d56
commit
80022c035b
3 changed files with 26 additions and 1 deletions
2
NEWS
2
NEWS
|
@ -7,6 +7,8 @@ PHP NEWS
|
|||
(psumbera)
|
||||
. Fixed bug GH-18581 (Coerce numeric string keys from iterators when argument
|
||||
unpacking). (ilutov)
|
||||
. Fixed OSS-Fuzz #434346548 (Failed assertion with throwing __toString in
|
||||
binary const expr). (ilutov)
|
||||
|
||||
- FTP:
|
||||
. Fix theoretical issues with hrtime() not being available. (nielsdos)
|
||||
|
|
22
Zend/tests/oss_fuzz_434346548.phpt
Normal file
22
Zend/tests/oss_fuzz_434346548.phpt
Normal file
|
@ -0,0 +1,22 @@
|
|||
--TEST--
|
||||
OSS-Fuzz #434346548: Failed assertion with throwing __toString in binary const expr
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Foo {
|
||||
function __toString() {}
|
||||
}
|
||||
|
||||
function test($y = new Foo() < "") {
|
||||
var_dump();
|
||||
}
|
||||
|
||||
try {
|
||||
test();
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Foo::__toString(): Return value must be of type string, none returned
|
|
@ -548,9 +548,10 @@ ZEND_API zend_result ZEND_FASTCALL zend_ast_evaluate_inner(
|
|||
ret = FAILURE;
|
||||
} else {
|
||||
binary_op_type op = get_binary_op(ast->attr);
|
||||
ret = op(result, &op1, &op2);
|
||||
op(result, &op1, &op2);
|
||||
zval_ptr_dtor_nogc(&op1);
|
||||
zval_ptr_dtor_nogc(&op2);
|
||||
ret = EG(exception) ? FAILURE : SUCCESS;
|
||||
}
|
||||
break;
|
||||
case ZEND_AST_GREATER:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue