|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2198 imagettftext crashes
Submitted: 1999-08-31 02:38 UTC Modified: 2002-06-16 08:39 UTC
From: Kimmo dot Mustonen at hut dot fi Assigned:
Status: Not a bug Package: Reproducible Crash
PHP Version: 3.0.12 OS: Digital Unix 4.0b
Private report: No CVE-ID: None
 [1999-08-31 02:38 UTC] Kimmo dot Mustonen at hut dot fi
I have php-3.0.12, freetype-1.2 and gd-1.3 (not updated, because the
newest ones don't support gif images any more) and it crashes on
AlphaServer 800 & Digital Unix 4.0b. I had earlier an older version of
php-3 and freetype-1.1 and it crashed very often with apache-1.3.x. Now
this crashes all the time with apache and very often when run from command
line without apache at all. On 32-bit Linux/i386 it seems to be working,
but on 64-bit Alpha is not working. Any idea what could be causing the

I had an older version of ariblk.ttf font and even ftstrpnm command
crashed with it (for example, when trying to write only one letter, G
(71), letter A (65) pointer became corrupted (should have been NULL, was
0x4). A newer version from font (updated Win95) helped with this problem
and now it doesn't seem to crash, at least not so easily. Both the font
versions worked fine on 32-bit Linux/i386, though.

I'll continue debugging this but if you have any idea, please let me know 
asap.> more font.php3
Header("Content-type: image/gif");
$im = imagecreate(400,30);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
ImageTTFText($im, 20, 0, 10, 20, $white, "ariblk.ttf",
?>> ls -l ariblk.ttf
-rwxr--r--   1 kimu01   system    117004 Aug 30 12:51 ariblk.ttf> uname -a 
OSF1 V4.0 564 alpha> ./php > tmp.gif font.php3
Segmentation fault (core dumped)> gdb ./php core
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.  
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "alphaev56-dec-osf4.0b"...
Core was generated by `php'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/lib/
Reading symbols from /usr/shlib/
Reading symbols from /usr/shlib/
Reading symbols from /usr/shlib/
#0  0x120077438 in gdttfchar (im=0x1400d6800, fg=0, font=0x1400dca00, x=10,
    y=20, x1=20, y1=0, advance=0x11fffe3a0, bbox=0x11fffe3a8, next=0x11fffe3b0)
    at functions/gdttf.c:742
742                                     tweencolorkey.pixel =
(gdb) bt
#0  0x120077438 in gdttfchar (im=0x1400d6800, fg=0, font=0x1400dca00, x=10,
    y=20, x1=20, y1=0, advance=0x11fffe3a0, bbox=0x11fffe3a8, next=0x11fffe3b0)
    at functions/gdttf.c:742
#1  0x120077778 in gdttf (im=0x1400d6800, brect=0x11fffe460, fg=1,
    fontname=0x340 <Address 0x340 out of bounds>, ptsize=20, angle=0, x=10,
    y=20, string=0x1400dc7b0
"abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ") at
#2  0x120057900 in php3_imagettftext_common (ht=0x3ffc0082770,
    return_value=0x140046440, list=0x1400d6800, plist=0x4422, mode=1074649536)
    at functions/gd.c:1829
#3  0x120057658 in php3_imagettftext (ht=0x3ffc0082770, return_value=0x0,
    list=0xffffffffffffffc0, plist=0x4422) at functions/gd.c:1772
#4  0x12001da38 in phpparse () at control_structures_inline.h:934 
#5  0x12002b228 in php3_parse (yyin=0x3ffc0082770) at main.c:1553
#6  0x12002baf8 in main (argc=2, argv=0x11ffffcc8) at main.c:1862

Almost default php3.ini file, only change is
log_errors              =       On

./configure --without-apache --with-mysql=/usr/local/mysql --with-gd=../gd1.3 --with-ttf=../freetype-1.2 --enable-memory=limit=yes --enable-debug=yes


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-16 08:39 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately, PHP 3 is no longer supported. Please download
the latest version of PHP 4 from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Sep 18 17:01:53 2020 UTC