[php-src] Issue #22649: SEGV zim_ZipArchive_setCommentIndex

From: Date: Thu, 09 Jul 2026 08:40:14 +0000
Subject: [php-src] Issue #22649: SEGV zim_ZipArchive_setCommentIndex
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-252380@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/22649 Author: YuanchengJiang ### Description The following code: ```php <?php try { $zip = new ZipArchive; $file = $dirname . 'oo_setcomment.zip'; if (!$zip->open($file, ZIPARCHIVE::CREATE)) { } $zip->addFromString('dir/entry2d.txt', 'entry #2'); var_dump($zip->setCommentName('dir/entry2d.txt', 'dir/entry2d.txt')); } catch (\Throwable $_ffl_e) {} ``` Resulted in this output: ``` AddressSanitizer:DEADLYSIGNAL ================================================================= ==3555404==ERROR: AddressSanitizer: SEGV on unknown address 0x00000b800043 (pc 0x7f43b11c4c72 bp 0x7ffdeab7ccd0 sp 0x7ffdeab7c468 T0) ==3555404==The signal is caused by a READ memory access. #0 0x7f43b11c4c72 string/../sysdeps/x86_64/multiarch/memcmp-sse4.S:109 #1 0x61bfae in MemcmpInterceptorCommon(void*, int (*)(void const*, void const*, unsigned long), void const*, void const*, unsigned long) (/home/fuzz/WorkSpace/fusion-fuzz/projects/php/php-src/sapi/cli/php+0x61bfae) #2 0x61c32a in memcmp (/home/fuzz/WorkSpace/fusion-fuzz/projects/php/php-src/sapi/cli/php+0x61c32a) #3 0x7f43b127209e in zip_file_set_comment (/lib/x86_64-linux-gnu/libzip.so.4+0x709e) #4 0x476d3d3 in zim_ZipArchive_setCommentIndex /home/fuzz/WorkSpace/fusion-fuzz/projects/php/php-src/ext/zip/php_zip.c:2231:2 LLVMSymbolizer: error reading file: No such file or directory #5 0x483a9708 (/dev/zero (deleted)+0x8003708) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV string/../sysdeps/x86_64/multiarch/memcmp-sse4.S:109 ==3555404==ABORTING ``` To reproduce: ``` /home/fuzz/WorkSpace/fusion-fuzz/projects/php/php-src/sapi/cli/php ./test.php ``` Commit: ``` 9dc29aafa5eecc71a9f9e2c7607b588597a91810 ``` 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 bug was found by [fusion-fuzz](https://github.com/fusion-fuzz/fusion-fuzz)* ### PHP Version ```plain nightly ``` ### Operating System _No response_

« previous php.bugs (#252380) next »