Page 1 of 1

perlmagick newbies beware

Posted: 2007-11-29T11:06:48-07:00
by zombieite
in ubuntu gutsy gibbon, and also in ubuntu 6.10, i've made the mistake of not creating an Image::Magick object before trying to read in a file.

the correct way is, to first make the object using new(), then do the call to Read() using that object.

Code: Select all

my $image = Image::Magick->new();
$image->Read($file);
the very, very wrong way is to try this:

Code: Select all

my $image = Image::Magick->Read($file);
it makes a huge nasty error (below), and googling this error gets you nowhere. so i'm posting it here so maybe the next googler will find it. i think it would be a useful improvement in perlmagick for it to catch this error for you and die with a helpful message instead of dumping core.

scary error follows!

Code: Select all

*** glibc detected *** /usr/local/bin/perl: double free or corruption (fasttop): 0x08174c80 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7e27d65]
/lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7e2b800]
/usr/lib/libMagick.so.9(RelinquishMagickMemory+0x21)[0xb79706b1]
/usr/lib/perl5/auto/Image/Magick/Magick.so(XS_Image__Magick_Read+0x25d)[0xb7c1e55d]
/usr/local/bin/perl(Perl_pp_entersub+0x3ab)[0x80c23cb]
/usr/local/bin/perl(Perl_runops_standard+0x19)[0x80c0d29]
/usr/local/bin/perl(perl_run+0x2ea)[0x806727a]
/usr/local/bin/perl(main+0x112)[0x8063732]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb7dd4050]
/usr/local/bin/perl[0x80635b1]
======= Memory map: ========
08048000-0814c000 r-xp 00000000 08:01 8766247    /usr/bin/perl
0814c000-08150000 rw-p 00103000 08:01 8766247    /usr/bin/perl
08150000-083c8000 rw-p 08150000 00:00 0          [heap]
b7300000-b7321000 rw-p b7300000 00:00 0 
b7321000-b7400000 ---p b7321000 00:00 0 
b740e000-b7418000 r-xp 00000000 08:01 5636163    /lib/libgcc_s.so.1
b7418000-b7419000 rw-p 0000a000 08:01 5636163    /lib/libgcc_s.so.1
b7419000-b741d000 r-xp 00000000 08:01 8766771    /usr/lib/libXdmcp.so.6.0.0
b741d000-b741e000 rw-p 00003000 08:01 8766771    /usr/lib/libXdmcp.so.6.0.0
b741e000-b7420000 r-xp 00000000 08:01 8766760    /usr/lib/libXau.so.6.0.0
b7420000-b7421000 rw-p 00001000 08:01 8766760    /usr/lib/libXau.so.6.0.0
b7421000-b746e000 r-xp 00000000 08:01 8766801    /usr/lib/libXt.so.6.0.0
b746e000-b7472000 rw-p 0004c000 08:01 8766801    /usr/lib/libXt.so.6.0.0
b7472000-b74b6000 r-xp 00000000 08:01 8767246    /usr/lib/libjasper.so.1.0.0
b74b6000-b74b9000 rw-p 00044000 08:01 8767246    /usr/lib/libjasper.so.1.0.0
b74b9000-b74bf000 rw-p b74b9000 00:00 0 
b74bf000-b74d3000 r-xp 00000000 08:01 8767538    /usr/lib/libz.so.1.2.3.3
b74d3000-b74d4000 rw-p 00013000 08:01 8767538    /usr/lib/libz.so.1.2.3.3
b74d4000-b75ec000 r-xp 00000000 08:01 8767532    /usr/lib/libxml2.so.2.6.30
b75ec000-b75f1000 rw-p 00118000 08:01 8767532    /usr/lib/libxml2.so.2.6.30
b75f1000-b75f2000 rw-p b75f1000 00:00 0 
b75f2000-b7601000 r-xp 00000000 08:01 5636135    /lib/libbz2.so.1.0.4
b7601000-b7602000 rw-p 0000f000 08:01 5636135    /lib/libbz2.so.1.0.4
b7602000-b76ef000 r-xp 00000000 08:01 8766754    /usr/lib/libX11.so.6.2.0
b76ef000-b76f3000 rw-p 000ed000 08:01 8766754    /usr/lib/libX11.so.6.2.0
b76f3000-b7708000 r-xp 00000000 08:01 8766732    /usr/lib/libICE.so.6.3.0
b7708000-b770a000 rw-p 00014000 08:01 8766732    /usr/lib/libICE.so.6.3.0
b770a000-b770b000 rw-p b770a000 00:00 0 
b770b000-b7712000 r-xp 00000000 08:01 8766750    /usr/lib/libSM.so.6.0.0
b7712000-b7713000 rw-p 00006000 08:01 8766750    /usr/lib/libSM.so.6.0.0
b7713000-b7720000 r-xp 00000000 08:01 8766775    /usr/lib/libXext.so.6.4.0
b7720000-b7721000 rw-p 0000d000 08:01 8766775    /usr/lib/libXext.so.6.4.0
b7721000-b7743000 r-xp 00000000 08:01 8765983    /usr/lib/libpng12.so.0.15.0
b7743000-b7744000 rw-p 00021000 08:01 8765983    /usr/lib/libpng12.so.0.15.0
b7744000-b7763000 r-xp 00000000 08:01 8767248    /usr/lib/libjpeg.so.62.0.0
b7763000-b7764000 rw-p 0001e000 08:01 8767248    /usr/lib/libjpeg.so.62.0.0
b7764000-b77d0000 r-xp 00000000 08:01 8766976    /usr/lib/libfreetype.so.6.3.16
b77d0000-b77d4000 rw-p 0006b000 08:01 8766976    /usr/lib/libfreetype.so.6.3.16
b77d4000-b7826000 r-xp 00000000 08:01 8767480    /usr/lib/libtiff.so.4.2.1
b7826000-b7828000 rw-p 00052000 08:01 8767480    /usr/lib/libtiff.so.4.2.1
b7828000-b7855000 r-xp 00000000 08:01 8767264    /usr/lib/liblcms.so.1.0.16
b7855000-b7857000 rw-p 0002c000 08:01 8767264    /usr/lib/liblcms.so.1.0.16
b7857000-b7859000 rw-p b7857000 00:00 0 
b7859000-b7b24000 r-xp 00000000 08:01 8766738    /usr/lib/libMagick.so.9.0.0
b7b24000-b7be1000 rw-p 002ca000 08:01 8766738    /usr/lib/libMagick.so.9.0.0
b7be1000-b7bfb000 rw-p b7be1000 00:00 0 
b7c06000-b7c43000 r-xp 00000000 08:01 8914865    /usr/lib/perl5/auto/Image/Magick/Magick.so
b7c43000-b7c49000 rw-p 0003d000 08:01 8914865    /usr/lib/perl5/auto/Image/Magick/Magick.so
b7c49000-b7c6a000 rw-p b7c49000 00:00 0 
b7c6a000-b7ca9000 r--p 00000000 08:01 8831858    /usr/lib/locale/en_US.utf8/LC_CTYPE
b7ca9000-b7caa000 r--p 00000000 08:01 8831863    /usr/lib/locale/en_US.utf8/LC_NUMERIC
b7caa000-b7cab000 r--p 00000000 08:01 8831866    /usr/lib/locale/en_US.utf8/LC_TIME
b7cab000-b7d8b000 r--p 00000000 08:01 8831857    /usr/lib/locale/en_US.utf8/LC_COLLATE
b7d8b000-b7d8c000 r--p 00000000 08:01 8831861    /usr/lib/locale/en_US.utf8/LC_MONETARY
b7d8c000-b7d8d000 r--p 00000000 08:01 8847394    /usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES
b7d8d000-b7d8e000 r--p 00000000 08:01 8831864    /usr/lib/locale/en_US.utf8/LC_PAPER
b7d8e000-b7d8f000 r--p 00000000 08:01 8831862    /usr/lib/locale/en_US.utf8/LC_NAME
b7d8f000-b7d90000 rw-p b7d8f000 00:00 0 
b7d90000-b7d95000 r-xp 00000000 08:01 5669837    /lib/tls/i686/cmov/libcrypt-2.6.1.so
b7d95000-b7d97000 rw-p 00004000 08:01 5669837    /lib/tls/i686/cmov/libcrypt-2.6.1.so
b7d97000-b7dbe000 rw-p b7d97000 00:00 0 
b7dbe000-b7f02000 r-xp 00000000 08:01 5669835    /lib/tls/i686/cmov/libc-2.6.1.so
b7f02000-b7f03000 r--p 00143000 08:01 5669835    /lib/tls/i686/cmov/libc-2.6.1.so
b7f03000-b7f05000 rw-p 00144000 08:01 5669835    /lib/tls/i686/cmov/libc-2.6.1.so
b7f05000-b7f08000 rw-p b7f05000 00:00 0 
b7f08000-b7f1c000 r-xp 00000000 08:01 5669849    /lib/tls/i686/cmov/libpthread-2.6.1.so
b7f1c000-b7f1e000 rw-p 00013000 08:01 5669849    /lib/tls/i686/cmov/libpthread-2.6.1.so
b7f1e000-b7f21000 rw-p b7f1e000 00:00 0 
b7f21000-b7f44000 r-xp 00000000 08:01 5669839    /lib/tls/i686/cmov/libm-2.6.1.so
b7f44000-b7f46000 rw-p 00023000 08:01 5669839    /lib/tls/i686/cmov/libm-2.6.1.so
b7f46000-b7f48000 r-xp 00000000 08:01 5669838    /lib/tls/i686/cmov/libdl-2.6.1.so
b7f48000-b7f4a000 rw-p 00001000 08:01 5669838    /lib/tls/i686/cmov/libdl-2.6.1.so
b7f4a000-b7f4b000 r--p 00000000 08:01 8831856    /usr/lib/locale/en_US.utf8/LC_ADDRESS
b7f4b000-b7f4c000 r--p 00000000 08:01 8831865    /usr/lib/locale/en_US.utf8/LC_TELEPHONE
b7f4c000-b7f4d000 r--p 00000000 08:01 8831860    /usr/lib/locale/en_US.utf8/LC_MEASUREMENT
b7f4d000-b7f54000 r--s 00000000 08:01 8782350    /usr/lib/gconv/gconv-modules.cache
b7f54000-b7f55000 r--p 00000000 08:01 8831859    /usr/lib/locale/en_US.utf8/LC_IDENTIFICATION
b7f55000-b7f57000 rw-p b7f55000 00:00 0 
b7f57000-b7f71000 r-xp 00000000 08:01 5636109    /lib/ld-2.6.1.so
b7f71000-b7f73000 rw-p 00019000 08:01 5636109    /lib/ld-2.6.1.so
bfc74000-bfc8e000 rw-p bfc74000 00:00 0          [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0          [vdso]
Aborted (core dumped)

Re: perlmagick newbies beware

Posted: 2007-11-29T11:43:44-07:00
by magick
We have a patch in ImageMagick-6.3.7-2 Beta to fix the problem you reported. Thanks.