You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Segmentation fault with frameless functions and undefined CVs #16009
/php-src/main/spprintf.c:376:14: runtime error: member access within misaligned address 0x200238000000002 for type 'zend_string' (aka 'struct _zend_string'), which requires 8 byte alignment
<?php
function testMin2Second(): int {
$value = min(100, $value);
return $value;
}
function testMin2_TMP(int $value): int {
return min($value + 1, 100);
}
testMin2Second();
ASAN:
==3604==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x5666e7a5a809 bp 0x7ffd589392b0 sp 0x7ffd58938cb0 T0)
==3604==The signal is caused by a READ memory access.
==3604==Hint: this fault was caused by a dereference of a high value address (see register values below). Disassemble the provided pc to learn which register was used.
#0 0x5666e7a5a809 in xbuf_format_converter /run/media/niels/MoreData/php-src/main/spprintf.c:376
#1 0x5666e7a5e76e in php_printf_to_smart_str /run/media/niels/MoreData/php-src/main/spprintf.c:784
#2 0x5666e7fbd224 in zend_vstrpprintf /run/media/niels/MoreData/php-src/Zend/zend.c:338
#3 0x5666e7fc32b9 in zend_error_va_list /run/media/niels/MoreData/php-src/Zend/zend.c:1589
#4 0x5666e7fc3cdc in zend_error_unchecked /run/media/niels/MoreData/php-src/Zend/zend.c:1664
#5 0x78f3c2a79eba in zend_jit_undefined_op_helper ext/opcache/jit/zend_jit_helpers.c:351
#6 0x49451cfe (/dev/zero (deleted)+0x8000cfe)
Reminds me of the other issue that had some type+value store missing. In this case for undef variables probably.
EDIT: also if you change the code to the following, you get an interesting error message:
<?php
function testMin2Second(): int {
$value = min(100, $value);
return $value;
}
testMin2Second();
Activity
DanielEScherzer commentedon Sep 23, 2024
Smaller reproduction, but not minimal given the report below
ndossche commentedon Sep 23, 2024
More minimal:
ASAN:
Reminds me of the other issue that had some type+value store missing. In this case for undef variables probably.
EDIT: also if you change the code to the following, you get an interesting error message:
Gives:
Warning: Undefined variable $testmin2secondndossche commentedon Sep 23, 2024
It's related to FLFs, as removing the annotation fixes OP's issue and the strange undefined variable one I reported.
ndossche commentedon Sep 23, 2024
I think I got it, after we perform
zend_jit_zval_check_undefwe may need to update the op addresses, I'll test this a bit and make a PR.[-]Segmentation fault in main/spprintf.c[/-][+]Segmentation fault with frameless functions and undefined CVs[/+]Fix phpGH-16009: Segmentation fault with frameless functions and unde…
Fix GH-16009: Segmentation fault with frameless functions and undefin…
Merge branch 'PHP-8.4'