[php-src] Issue #19955: memory leak imagefttext
| From: | YuanchengJiang | Date: | Thu, 25 Sep 2025 06:10:02 +0000 |
| Subject: | [php-src] Issue #19955: memory leak imagefttext | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250914@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19955
Author: YuanchengJiang
### Description
The following code:
```php
<?php
$im = imagecreate(64, 32);
imagefttext($im, 16, 0, 10, 23, $fg, __DIR__ . "/Tuffy.ttf", 'Ж');
```
Resulted in this output:
```
=================================================================
==2337091==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 112 byte(s) in 1 object(s) allocated from:
#0 0x6810bd in malloc (/home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php+0x6810bd)
#1 0x70f14238b76c in __gconv_open iconv/./iconv/gconv_open.c:77:28
#2 0x70f14238b2b7 in iconv_open iconv/./iconv/iconv_open.c:39:13
#3 0x60200001aa0f (<unknown module>)
Indirect leak of 32640 byte(s) in 1 object(s) allocated from:
#0 0x6810bd in malloc (/home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php+0x6810bd)
#1 0x70f14238b7e6 in __gconv_open iconv/./iconv/gconv_open.c:127:36
#2 0x70f14238b2b7 in iconv_open iconv/./iconv/iconv_open.c:39:13
#3 0x60200001aa0f (<unknown module>)
Indirect leak of 208 byte(s) in 1 object(s) allocated from:
#0 0x6810bd in malloc (/home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php+0x6810bd)
#1 0x70f1423969d6 in __gconv_lookup_cache iconv/./iconv/gconv_cache.c:365:36
SUMMARY: AddressSanitizer: 32960 byte(s) leaked in 3 allocation(s).
```
To reproduce:
```
./php-src/sapi/cli/php ./test.php
```
Commit:
```
e23c6222da50a2c5828a03ad701cd3351b13590d
```
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_