develooper Front page | perl.perl5.porters | Postings from January 2001

Something in perlio broke GD.pm

Thread Next
From:
andreas.koenig
Date:
January 10, 2001 00:34
Subject:
Something in perlio broke GD.pm
Message ID:
m38zojyfdn.fsf@ak-71.mind.de
On my two testing machines GD dumps core now. 

On the one machine I have glibc-2.1.3 and egcs-1.1.2 and the core
dumps started with patch 8282. Here is a stack trace:

(gdb) bt
#0  0x400a8191 in _IO_sgetn (fp=0x815e760, data=0xbffff67c, n=8)
    at genops.c:431
#1  0x400a3b34 in _IO_fread (buf=0xbffff67c, size=1, count=8, fp=0x815e760)
    at iofread.c:42
#2  0x401bf0b7 in fileGetbuf (ctx=0x815cde0, buf=0xbffff67c, size=8)
    at gd_io_file.c:95
#3  0x401bef8f in gdGetBuf (buf=0xbffff67c, size=8, ctx=0x815cde0)
    at gd_io.c:140
#4  0x401bf8af in gdImageCreateFromPngCtx (infile=0x815cde0) at gd_png.c:120
#5  0x401bf862 in gdImageCreateFromPng (inFile=0x815e760) at gd_png.c:87
#6  0x401a8d87 in XS_GD__Image__newFromPng (cv=0x827f0e0) at GD.xs:365
#7  0x80c3165 in Perl_pp_entersub () at pp_hot.c:2663
#8  0x80b9a0c in Perl_runops_debug () at run.c:53
#9  0x805eec9 in S_run_body (oldscope=1) at perl.c:1457
#10 0x805eabd in perl_run (my_perl=0x8155580) at perl.c:1379
#11 0x805b99b in main (argc=3, argv=0xbffff884, env=0xbffff894)
    at perlmain.c:52

On the other machine I have linux-2.4.0 and glibc-2.2. The core dumps
started here with patch 8273 and the stack trace looks like so:

(gdb) bt
#0  0x400c0d61 in ?? () from /lib/libc.so.6
#1  0x400b77ad in ?? () from /lib/libc.so.6
#2  0x401b3702 in ?? ()
   from /root/.cpan/build/GD-1.32/./blib/arch/auto/GD/GD.so
#3  0x401b327a in ?? ()
   from /root/.cpan/build/GD-1.32/./blib/arch/auto/GD/GD.so
#4  0x401b3860 in ?? ()
   from /root/.cpan/build/GD-1.32/./blib/arch/auto/GD/GD.so
#5  0x401b3821 in ?? ()
   from /root/.cpan/build/GD-1.32/./blib/arch/auto/GD/GD.so
#6  0x401a202b in ?? ()
   from /root/.cpan/build/GD-1.32/./blib/arch/auto/GD/GD.so
#7  0x80c307b in Perl_pp_entersub () at pp_hot.c:2663
#8  0x80b98ef in Perl_runops_debug () at run.c:53
#9  0x805f1bf in S_run_body (oldscope=1) at perl.c:1457
#10 0x805ed82 in perl_run (my_perl=0x814b200) at perl.c:1379
#11 0x805b9b5 in main (argc=3, argv=0xbffffaec, env=0xbffffafc)
    at perlmain.c:52

On this second box the compiler (gcc-2.95.2) issues a warning

  GD.xs: In function `XS_GD__Image_newFromXpm':
  GD.xs:546: warning: assignment makes pointer from integer without a cast

But this should not be relevant to my case because I compiled without
XPM support.

In both cases the coredump happens during 

  DB<1> 
main::test1(t/GD.t:94):     open (TILE,"./tile.png") || die "Can't open tile file: $!";
  DB<1> 
main::test1(t/GD.t:95):     my($tile) = newFromPng GD::Image(TILE);
  DB<1> 
Signal SEGV at t/GD.t line 95
        main::test1() called at t/GD.t line 32


GD.xs has this definition of newFromPng:

GD::Image
gd_newFromPng(packname="GD::Image", filehandle)
        char *  packname
        InputStream     filehandle
        PROTOTYPE: $$
        CODE:
        RETVAL = (GD__Image) GDIMAGECREATEFROMPNG(filehandle);
        OUTPUT:
        RETVAL



Is it possible to guess what might be needed to fix the core dumps?

-- 
andreas

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About