PHP 4.0 Bug #2279: Apache w/ modphp4 w/ libgd segfaults at imagegif()

From: Date: Fri, 10 Sep 1999 18:55:35 +0000
Subject: PHP 4.0 Bug #2279: Apache w/ modphp4 w/ libgd segfaults at imagegif()
Groups: php.dev 
Request: Send a blank email to php-dev+get-10805@lists.php.net to get a copy of this message
From: christ@insynq.com Operating system: RedHat 6.0 PHP version: 4.0 Beta 2 PHP Bug Type: Reproduceable crash Bug description: Apache w/ modphp4 w/ libgd segfaults at imagegif() This iwll crash an apache thread. <? header("Content-Type: image/gif"); $f=4; $fontw=8; $fonth=16; $hspace = 3; $vspace = 3; $bspace = 15; $string = $GLOBALS["text"]; if (!$string) { $string = substr($GLOBALS["PATH_INFO"],1); }; $high=$fonth + ( $hspace * 2); $twide=( strlen($string) * $fontw ) + ( $vspace * 2); $bwide = $twide + ( $bspace * 2 ); $img = imagecreate($bwide+1,$high+1); $black = imagecolorallocate($img,0,0,0); $red = imagecolorallocate($img,255,0,0); $ltgrey = imagecolorallocate($img,150,150,150); imagefill($img,1,1,$ltgrey); imagestring($img,$f,$vspace+$bspace+1,$high-$fonth-$hspace+1,$string,$black); imagestring($img,$f,$vspace+$bspace,$high-$fonth-$hspace,$string,$red); imagegif($img); ?> The problem seems to be in ext/gd/gd.c around line 811, at fclose(tmp). I changed it to close(tmp), and it works fine. Also, the newest gd libraries don't have any of the Gif calls, so the calls to GdImageGif and GdImageCreateFromGif should be changed to the Png calls if the. something like this #ifndef GD2_VER #define GdImageGif(x) GdImagePng(x) #define GdImageCreateFromGif(x) GdImageCreateFromPng(x) #else #ifndef GdImagePng #define GdImagePng(x) GdImageGif(x) #define GdImageCreateFromPng(x) GdImageCreateFromGif(x) #endif #endif

« previous php.dev (#10805) next »