|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12894 GD crashes PHP by using GD Format
Submitted: 2001-08-22 09:20 UTC Modified: 2001-10-03 20:40 UTC
From: alberty at neptunlabs dot de Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.0.7-dev (latest CVS) OS: i686-pc-linux-gnu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: alberty at neptunlabs dot de
New email:
PHP Version: OS:


 [2001-08-22 09:20 UTC] alberty at neptunlabs dot de

the follow 2 different scripts using ImageCreateFromGD & ImageGD2
and crashes PHP.

(using gd2.0.1 and 4.0.6)




// the gd image is created with pngtogd from the gd lib package.





Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-22 10:57 UTC]
I doubt that you could crash PHP by using functions
that don't exist..

Both imageGD2 and ImageCreateFromGD where added
AFTER PHP 4.0.6 was released. So they are only
available in the CVS.

And with the latest CVS version, both of your
scripts work just fine.


 [2001-08-22 12:13 UTC] alberty at neptunlabs dot de
Sorry, my submitted PHP Version was wrong. I mean 4.0.7-dev from the latest CVS.

The script crash under cvs version.


 [2001-08-22 13:04 UTC]
I can't get your scripts to crash.
Could you please generate a GDB backtrace of the crash?


 [2001-08-27 08:50 UTC] alberty at neptunlabs dot de
Hi Jani,

here is the backtrace of the second script:

Program received signal SIGSEGV, Segmentation fault.
0x40411786 in gd_module_entry () from /usr/local/apache/current/libexec/
(gdb) bt
#0  0x40411786 in gd_module_entry () from /usr/local/apache/current/libexec/

the script fails only if you call ImagePNG after the ImageCreateFromGD.

Also ImageGD2 creates corrupted files, but this is another bug ...


 [2001-08-30 22:36 UTC]
I can not reproduce this. Does this happen with that
example script included in this report?
Does this crash happen with specific images? Where could
I get those images? What was the configure line like
for configuring PHP ?


 [2001-10-02 19:05 UTC]
No feedback and not enought information. If problem still
exists with latest CVS / GD reopen with required information.

 [2001-10-03 08:04 UTC] alberty at neptunlabs dot de
oops, i have post a message to this problem in under: "GD seg fault on save"

however, here is another code example to reproduce
the problem:


The problem is _not_ ImageJPEG! You can reproduce the problem also with 

here is the backtrace:
Program received signal SIGSEGV, Segmentation fault.
gdImageJpegCtx (im=???, outfile=???, quality=???) at gd_jpeg.c:207
207                   int val = im->tpixels[i][j];
(gdb) bt
#0  gdImageJpegCtx (im=???, outfile=???, quality=???) at gd_jpeg.c:207

you can download the '' file under:

 [2001-10-03 20:40 UTC]
Your example GD file crashes even the GD binaries (gdtopng)
and also the backtrace indicates that the problem is not in
PHP but in GD library itself. Please report this to the GD
library author instead.


PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun May 26 03:01:26 2019 UTC