php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1554 imagettfbbox causes segmentation fault
Submitted: 1999-06-16 19:32 UTC Modified: 1999-06-19 05:07 UTC
From: jradford at npl dot com Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 3.0.9 OS: BSDI 4.0.1
Private report: No CVE-ID: None
 [1999-06-16 19:32 UTC] jradford at npl dot com
This code:

<? 
    Header( "Content-type: image/gif"); 
    if(!isset($s)) $s=11; 
    $size = imagettfbbox(10,0, "/usr/local/fonts/TIMES.TTF",$text); 
    $dx = abs($size[2]-$size[0]); 
    $dy = abs($size[5]-$size[3]); 
    $xpad=9; 
    $ypad=9; 
    $im = imagecreate($dx+$xpad,$dy+$ypad); 
    $blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF); 
    $black = ImageColorAllocate($im, 0,0,0); 
    $white = ImageColorAllocate($im, 255,255,255); 
    ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black); 
    ImageRectangle($im,0,0,$dx+$xpad,$dy+$ypad,$white); 
    ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black,  "/usr/local/fonts/TIMES.TTF", $text); 
    ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $white,  "/usr/local/fonts/TIMES.TTF", $text); 
    ImageGif($im); 
    ImageDestroy($im); 
?>

It apparently is this line:
  $size = imagettfbbox(10,0, "/usr/local/fonts/TIMES.TTF",$text); 

causes A segmentation fault in apache's error_log, and of course the image is not displayed on both php 3.0.7, and 3.0.9.

the php.ini is blank

do-conf:
./configure --with-apache=../apache_1.3.6 --with-gd --with-mysql --with-ldap=/usr/local --with-imap --with-zlib
 --enable-debug=no

Apache Modules:
Compiled-in modules:
  http_core.c
  mod_env.c
  mod_log_config.c
  mod_mime_magic.c
  mod_mime.c
  mod_negotiation.c
  mod_status.c
  mod_info.c
  mod_include.c
  mod_autoindex.c
  mod_dir.c
  mod_cgi.c
  mod_asis.c
  mod_imap.c
  mod_actions.c
  mod_speling.c
  mod_userdir.c
  mod_proxy.c
  mod_alias.c
  mod_rewrite.c
  mod_access.c
  mod_auth.c
  mod_auth_anon.c
  mod_auth_dbm.c
  mod_digest.c
  mod_cern_meta.c
  mod_expires.c
  mod_headers.c
  mod_usertrack.c
  mod_unique_id.c
  mod_setenvif.c
  mod_php3.c
  mod_auth_mysql.c

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-06-19 05:07 UTC] rasmus at cvs dot php dot net
Fixed by doing a: make clean
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 03:01:33 2024 UTC