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
/home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_string.h:209:7: runtime error: member access within null pointer of type 'zend_string' (aka 'struct _zend_string')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_string.h:209:7 in
Warning: Unsupported declare 'unknown' in /tmp/warning_replay.inc on line 3
/home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_string.h:209:7: runtime error: member access within null pointer of type 'zend_string' (aka 'struct _zend_string')
phpfuzz@1ef1f1eacc98:~/WorkSpace/flowfusion$
#0 0x50ab3e2 in zend_string_copy /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_string.h:209:7
#1 0x509a61a in php_error_cb /home/phpfuzz/WorkSpace/flowfusion/php-src/main/main.c:1399:28
#2 0x3ba7944 in soap_error_handler /home/phpfuzz/WorkSpace/flowfusion/php-src/ext/soap/soap.c:1962:3
#3 0x68be5b9 in zend_error_zstr_at /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend.c:1533:3
#4 0x68c4604 in zend_emit_recorded_errors_ex /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend.c:1788:3
#5 0x68bb36b in zend_error_zstr_at /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend.c:1471:3
#6 0x68c4604 in zend_emit_recorded_errors_ex /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend.c:1788:3
#7 0x68c7205 in zend_emit_recorded_errors /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend.c:1795:2
#8 0x23f6a2c in persistent_compile_file /home/phpfuzz/WorkSpace/flowfusion/php-src/ext/opcache/ZendAccelerator.c:2212:3
#9 0x6585e09 in compile_filename /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_language_scanner.l:717:11
#10 0x627da54 in zend_include_or_eval /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_execute.c:5349:19
#11 0x5e66d55 in ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_vm_execute.h:5370:17
#12 0x5b44f7b in execute_ex /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_vm_execute.h:115722:12
#13 0x5b4750c in zend_execute /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_vm_execute.h:121434:2
#14 0x68cb7a9 in zend_execute_script /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend.c:1977:3
#15 0x50a616a in php_execute_script_ex /home/phpfuzz/WorkSpace/flowfusion/php-src/main/main.c:2640:13
#16 0x50a72a8 in php_execute_script /home/phpfuzz/WorkSpace/flowfusion/php-src/main/main.c:2680:9
#17 0x68e06ba in do_cli /home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php_cli.c:951:5
#18 0x68daa9f in main /home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php_cli.c:1362:18
#19 0x766c086a8d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#20 0x766c086a8e3f in __libc_start_main csu/../csu/libc-start.c:392:3
#21 0x6061f4 in _start (/home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php+0x6061f4)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_string.h:209:7 in
I can reproduce this. It happens when both processes race to compile warning_replay.inc. Whichever is first will get to persist the script. The loser will enter this branch:
Here, the script that is already persisted is used instead, and the script that was just compiled is freed. However, EG(errors) and persistent_script->warnings still refer to the same allocation, and EG(errors) becomes a dangling pointer. To solve this, we can simply set EG(errors) and EG(num_errors) to NULL and 0, respectively.
Furthermore, we need to adjust some calls to zend_emit_recorded_errors() that would previously use EG(errors), even when persistent_script has been swapped out.
@arnaud-lb Does this approach look correct to you? If so, I'll create a PR. Edit: I created it anyway. #19995 And also removed the diff, so check in the PR as there were some changes.
Activity
devnexen commentedon Sep 29, 2025
Cannot reproduce, what
UBSAN_OPTIONS="print_stacktrace=1" ./php-src/sapi/cli/php -d "opcache.record_warnings=1" -d "opcache.enable_cli=1" ./test.phpoutput gives ?YuanchengJiang commentedon Sep 29, 2025
arnaud-lb commentedon Sep 29, 2025
It could possibly be related to #18541, however I can't reproduce either.
iluuu1994 commentedon Sep 29, 2025
I can reproduce this. It happens when both processes race to compile
warning_replay.inc. Whichever is first will get to persist the script. The loser will enter this branch:php-src/ext/opcache/ZendAccelerator.c
Line 1605 in 8982351
Here, the script that is already persisted is used instead, and the script that was just compiled is freed. However,
EG(errors)andpersistent_script->warningsstill refer to the same allocation, andEG(errors)becomes a dangling pointer. To solve this, we can simply setEG(errors)andEG(num_errors)toNULLand0, respectively.Furthermore, we need to adjust some calls to
zend_emit_recorded_errors()that would previously useEG(errors), even whenpersistent_scripthas been swapped out.@arnaud-lb Does this approach look correct to you? If so, I'll create a PR. Edit: I created it anyway. #19995 And also removed the diff, so check in the PR as there were some changes.