Fix GH-15821: Core dumped in Zend/Optimizer/zend_inference.c:4062

This commit is contained in:
Dmitry Stogov 2024-09-10 16:14:03 +03:00
parent 025ed70ce3
commit 7c8b3b2c96
No known key found for this signature in database
2 changed files with 21 additions and 1 deletions

View File

@ -4056,11 +4056,11 @@ static zend_always_inline zend_result _zend_update_type_info(
fprintf(stderr, "Missing op2 type inference for opcode %s, line %d\n", zend_get_opcode_name(opline->opcode), opline->lineno);
}
#endif
unknown_opcode:
if (ssa_op->op1_def >= 0) {
tmp = MAY_BE_ANY | MAY_BE_REF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
UPDATE_SSA_TYPE(tmp, ssa_op->op1_def);
}
unknown_opcode:
if (ssa_op->result_def >= 0) {
tmp = MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
if (opline->result_type == IS_TMP_VAR) {

View File

@ -0,0 +1,20 @@
--TEST--
GH-15821 (Core dumped in Zend/Optimizer/zend_inference.c:4062)
--EXTENSIONS--
opcache
--INI--
opcache.jit=1203
opcache.jit_buffer_size=64M
--FILE--
<?php
$allInternalFunctions = array();
$definedFunctions = get_defined_functions();
$internalFunctions = $definedFunctions['internal'];
$allInternalFunctions = array_merge($allInternalFunctions, $internalFunctions);
$allInternalFunctions = array_filter($allInternalFunctions, function($func) {
strpos($func, 'posix_') !== 0;
});
echo "Done\n";
?>
--EXPECT--
Done