[php-src] Issue #19909: SEGV zend_mm_realloc_heap
| From: | YuanchengJiang | Date: | Sun, 21 Sep 2025 18:43:29 +0000 |
| Subject: | [php-src] Issue #19909: SEGV zend_mm_realloc_heap | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250871@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19909
Author: YuanchengJiang
### Description
The following code:
```php
<?php
class Node
{
}
$firstNode = new Node();
$node = $firstNode;
for ($i = 0; $i < 30000; $i++) {
$newNode = new Node();
$node->next = $newNode;
$node = $newNode;
}
```
Resulted in this output:
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==589452==ERROR: AddressSanitizer: SEGV on unknown address 0x70e438c00964 (pc 0x0000056ffffb bp
0x7ffc954d3440 sp 0x7ffc954d2e10 T0)
==589452==The signal is caused by a READ memory access.
#0 0x56ffffb in zend_mm_realloc_heap
/home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_alloc.c:1694:28
#1 0x5706959 in _erealloc /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_alloc.c:2804:9
#2 0x68a3b0d in zend_error_zstr_at
/home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend.c:1489:16
#3 0x68acdd1 in zend_error_va_list /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend.c:1635:2
#4 0x68ad0d5 in zend_error /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend.c:1705:2
#5 0x681088d in zend_signal_deactivate
/home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_signal.c:343:4
#6 0x5081091 in php_request_shutdown
/home/phpfuzz/WorkSpace/flowfusion/php-src/main/main.c:2058:2
#7 0x68cd3a1 in do_cli /home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php_cli.c:1158:3
#8 0x68c237f in main /home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php_cli.c:1362:18
#9 0x70e43f88bd8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#10 0x70e43f88be3f in __libc_start_main csu/../csu/libc-start.c:392:3
#11 0x6061f4 in _start (/home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php+0x6061f4)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_alloc.c:1694:28
in zend_mm_realloc_heap
==589452==ABORTING
```
To reproduce:
```
./php-src/sapi/cli/php ./test.php
```
Commit:
```
5c6f25bd64008e0883b53f1d1addd9dbe0d886e3
```
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
5c6f25bd64008e0883b53f1d1addd9dbe0d886e3
```
### Operating System
_No response_