[php-src] Issue #20302: SEGV phar zend_string.h
| From: | YuanchengJiang | Date: | Sun, 26 Oct 2025 15:05:48 +0000 |
| Subject: | [php-src] Issue #20302: SEGV phar zend_string.h | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251122@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20302
Author: YuanchengJiang
### Description
The following code:
```php
<?php
$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar';
$pname = 'phar://' . $fname;
$b = new PharFileInfo($pname . '/a/subdir/here');
require_once 'files/phar_oo_test.inc';
$phar = new Phar($fname);
{
var_dump($ent->getATime());
}
```
Resulted in this output:
```
/home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_string.h:329:2: runtime error: member access
within misaligned address 0x000000000106 for type 'zend_string' (aka 'struct
_zend_string'), which requires 8 byte alignment
0x000000000106: note: pointer points here
<memory cannot be printed>
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
/home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_string.h:329:2 in
```
To reproduce:
```
./php-src/sapi/cli/php -d "opcache.cache_id=worker21" -d "output_handler=" -d
"open_basedir=" -d "disable_functions=" -d "output_buffering=Off" -d
"error_reporting=30719" -d "display_errors=1" -d
"display_startup_errors=1" -d "log_errors=0" -d "html_errors=0" -d
"track_errors=0" -d "report_memleaks=1" -d "report_zend_debug=0" -d
"docref_root=" -d "docref_ext=.html" -d "error_prepend_string=" -d
"error_append_string=" -d "auto_prepend_file=" -d "auto_append_file="
-d "ignore_repeated_errors=0" -d "precision=14" -d
"serialize_precision=-1" -d "memory_limit=128M" -d
"opcache.fast_shutdown=0" -d "opcache.file_update_protection=2" -d
"opcache.revalidate_freq=0" -d "opcache.jit_hot_loop=1" -d
"opcache.jit_hot_func=1" -d "opcache.jit_hot_return=1" -d
"opcache.jit_hot_side_exit=1" -d "opcache.jit_max_root_traces=100000" -d
"opcache.jit_max_side_traces=100000" -d "opcache.jit_max_exit_counters=100000"
-d "opcache.protect_memory=1" -d "zend.assertions=1" -d
"zend.exception_ignore_args=0" -d "zend.exception_string_param_max_len=15" -d
"short_open_tag=0" -d
"extension_dir=/home/phpfuzz/WorkSpace/flowfusion/php-src/modules/" -d
"session.auto_start=0" -d "zlib.output_compression=Off" -d
"phar.require_hash=0" -d "phar.readonly=1" -d "opcache.enable=1" -d
"opcache.enable_cli=1" -d "opcache.jit=1205" ./test.php
```
Commit:
```
f8656fae35d90f89f2cef6a32c7173aa0c6b27a8
```
Configurations:
```
CC="clang-12" CXX="clang++-12" CFLAGS="-DZEND_VERIFY_TYPE_INFERENCE"
CXXFLAGS="-DZEND_VERIFY_TYPE_INFERENCE" ./configure --enable-debug
--enable-address-sanitizer --enable-undefined-sanitizer --enable-re2c-cgoto --enable-fpm
--enable-litespeed --enable-phpdbg-debug --enable-zts --enable-bcmath --enable-calendar --enable-dba
--enable-dl-test --enable-exif --enable-ftp --enable-gd --enable-gd-jis-conv --enable-mbstring
--enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-zend-test
--with-zlib --with-bz2 --with-curl --with-enchant --with-gettext --with-gmp --with-mhash --with-ldap
--with-libedit --with-readline --with-snmp --with-sodium --with-xsl --with-zip --with-mysqli
--with-pdo-mysql --with-pdo-pgsql --with-pgsql --with-sqlite3 --with-pdo-sqlite --with-webp
--with-jpeg --with-freetype --enable-sigchild --with-readline --with-pcre-jit --with-iconv
```
Operating System:
```
Ubuntu 20.04 Host, Docker 0599jiangyc/flowfusion:latest
```
*This report is automatically generated by [FlowFusion](https://github.com/php/flowfusion)*
### PHP Version
```plain
nightly
```
### Operating System
_No response_