1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix GH-19955: imagefttext() memory leak

close GH-19968
This commit is contained in:
David Carlier
2025-09-25 19:49:38 +01:00
parent 93bac8cb1a
commit e029f8f45b
3 changed files with 20 additions and 0 deletions

3
NEWS
View File

@@ -27,6 +27,9 @@ PHP NEWS
- DBA:
. Fixed GH-19885 (dba_fetch() overflow on skip argument). (David Carlier)
- GD:
. FIxed GH-19955 (imagefttext() memory leak). (David Carlier)
- SimpleXML:
. Fixed bug GH-19988 (zend_string_init with NULL pointer in simplexml (UB)).
(nielsdos)

View File

@@ -368,6 +368,8 @@ do_convert (unsigned char *to, unsigned char *from, const char *code)
else
error ("something happen");
strcpy ((char *) to, (const char *) from);
if (iconv_close (cd) != 0)
error ("iconv_close() error");
return;
}

15
ext/gd/tests/gh19955.phpt Normal file
View File

@@ -0,0 +1,15 @@
--TEST--
GH-19955: (imagefttext() memory leak)
--EXTENSIONS--
gd
--CREDITS--
YuanchengJiang
--FILE--
<?php
ini_set('error_reporting', E_ALL&~E_WARNING);
$im = imagecreate(64, 32);
imagefttext(imagecreate(8, 8), 0, 0, 0, 0, 255, __DIR__ . "/Tuffy.ttf", 'Ж');
echo "OK"
?>
--EXPECT--
OK