Skip Menu |

This queue is for tickets about the GD CPAN distribution.

Report information
The Basics
Id: 5995
Status: resolved
Worked: 1 min
Priority: 0/
Queue: GD

People
Owner: LDS [...] cpan.org
Requestors: slaven [...] rezic.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.12
Fixed in: (no value)



Subject: Core dump in newFromPng
GD::Image::newFromPng (may) dump core if the the supplied file is not a PNG file. Example (reproducible on FreeBSD 4.9 and RedHat Linux 8.0, both with perl5.8.0): #!/usr/bin/perl -w use GD; $image = GD::Image->newFromPng("/etc/passwd"); __END__ A gdb backtrace shows: (gdb) bt #0 0x402573ae in gd_chkimagefmt (image=0x0, truecolor=0) at GD.xs:499 #1 0x40257cfc in XS_GD__Image__newFromPng (cv=0x8251bb8) at GD.xs:566 #2 0x080cd4f0 in Perl_pp_entersub () at pp_hot.c:2854 #3 0x080afc71 in Perl_runops_debug () at dump.c:1442 #4 0x080624ca in S_run_body (oldscope=1) at perl.c:1921 #5 0x08062059 in perl_run (my_perl=0x816df68) at perl.c:1840 #6 0x0805e501 in main (argc=2, argv=0xbfffdc54, env=0xbfffdc60) at perlmain.c:86 #7 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6 Regards, Slaven
This is an issue with libgd. Please refer the bug report to Tom Boutell.
From: slaven [...] rezic.de
[LDS - Tue Apr 13 11:10:40 2004]: Show quoted text
> This is an issue with libgd. Please refer the bug report to Tom Boutell.
I don't think so. gd_chkimagefmt() is defined in GD.xs. Probably it should be changed to (not tested): void gd_chkimagefmt(GD__Image image, int truecolor) { if (image && !truecolor) { /* return a palette image */ if (gdImageTrueColor(image)) { gdImageTrueColorToPalette(image,1,gdMaxColors); } } } Regards, Slaven
I'm guessing that this was a bug in libgd (the C library). I can't reproduce it with libgd version 2.0.28, and so I hope it has been fixed since the original report was filed. If the problem is persistent, I might be able to work around this by checking the file types before passing the file names to the gd layer. Lincoln [SREZIC - Tue Apr 13 08:35:54 2004]: Show quoted text
> GD::Image::newFromPng (may) dump core if the the supplied file is not > a > PNG file. Example (reproducible on FreeBSD 4.9 and RedHat Linux 8.0, > both with perl5.8.0): > > #!/usr/bin/perl -w > use GD; > $image = GD::Image->newFromPng("/etc/passwd"); > __END__ > > A gdb backtrace shows: > > (gdb) bt > #0 0x402573ae in gd_chkimagefmt (image=0x0, truecolor=0) at
GD.xs:499 Show quoted text
> #1 0x40257cfc in XS_GD__Image__newFromPng (cv=0x8251bb8) at
GD.xs:566 Show quoted text
> #2 0x080cd4f0 in Perl_pp_entersub () at pp_hot.c:2854 > #3 0x080afc71 in Perl_runops_debug () at dump.c:1442 > #4 0x080624ca in S_run_body (oldscope=1) at perl.c:1921 > #5 0x08062059 in perl_run (my_perl=0x816df68) at perl.c:1840 > #6 0x0805e501 in main (argc=2, argv=0xbfffdc54, env=0xbfffdc60) > at perlmain.c:86 > #7 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6 > > Regards, > Slaven
From: srezic [...] cpan.org
[LDS - Mon Mar 7 13:20:13 2005]: Show quoted text
> I'm guessing that this was a bug in libgd (the C library). I can't > reproduce it with libgd version 2.0.28, and so I hope it has been fixed > since the original report was filed. If the problem is persistent, I > might be able to work around this by checking the file types before > passing the file names to the gd layer. >
I cannot reproduce the segfault with GD 2.19, libgd 2.0.28 on the Linux machine, so it seems really to be fixed. Regards, Slaven Show quoted text
> Lincoln > > [SREZIC - Tue Apr 13 08:35:54 2004]: >
> > GD::Image::newFromPng (may) dump core if the the supplied file is not > > a > > PNG file. Example (reproducible on FreeBSD 4.9 and RedHat Linux 8.0, > > both with perl5.8.0): > > > > #!/usr/bin/perl -w > > use GD; > > $image = GD::Image->newFromPng("/etc/passwd"); > > __END__ > > > > A gdb backtrace shows: > > > > (gdb) bt > > #0 0x402573ae in gd_chkimagefmt (image=0x0, truecolor=0) at
> GD.xs:499
> > #1 0x40257cfc in XS_GD__Image__newFromPng (cv=0x8251bb8) at
> GD.xs:566
> > #2 0x080cd4f0 in Perl_pp_entersub () at pp_hot.c:2854 > > #3 0x080afc71 in Perl_runops_debug () at dump.c:1442 > > #4 0x080624ca in S_run_body (oldscope=1) at perl.c:1921 > > #5 0x08062059 in perl_run (my_perl=0x816df68) at perl.c:1840 > > #6 0x0805e501 in main (argc=2, argv=0xbfffdc54, env=0xbfffdc60) > > at perlmain.c:86 > > #7 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6 > > > > Regards, > > Slaven
> > >
I've added proper error handling after libgd errors with 2.59 -- Reini Urban