Dashed lines crash in perlmagick
Posted: 2009-12-08T02:43:14-07:00
Hi,
When using the stroke-dasharray property of the Draw method, the program crashes.
Repro code:
I'm running on Kubuntu 9.10, however I've seen this behaviour on other Ubuntus and Debian installations as well.
With the vanilla imagemagick (v 6.5.1) and perl that come with (k)ubuntu 9.10 the following is being output:
Output:
No file is saved in this case. When setting MALLOC_CHECK_=1 in my environment (so the free error won't crash the program, but rather puts out a warning message instead) an image is saved and the line is dashed, and the following output is generated:
For a custom compiled Imagemagick (version 6.5.7-10) on the same system I get the same error:
Note that the perlmagick part of this imagemagick install is built against a custom perl (5.10.1) on the same system.
With MALLOC_CHECK_=1 exported into the envronment, the following gets output:
In this case a file is saved saved as well. The dashing is correct too. However, there are now two free() errors and a segfault is reported.
Related to this issue I found this, which may be of help: http://studio.imagemagick.org/pipermail ... 20888.html
If you need any additional information, or any other tests I can perform, please let me know.
Regards,
Martin Kamerbeek
http://www.oqapi.nl
When using the stroke-dasharray property of the Draw method, the program crashes.
Repro code:
Code: Select all
use Image::Magick;
my $im = Image::Magick->new( size => '100x100' );
print $im->Get('version'), "\n\n\n";
$im->Read( 'xc:white' );
$im->Draw(
primitive => 'Line',
stroke => 'black',
strokewidth => 10,
points => '10,50 90,50',
'stroke-dasharray' => [10,5,5],
);
$im->Write('segfault.png');
With the vanilla imagemagick (v 6.5.1) and perl that come with (k)ubuntu 9.10 the following is being output:
Output:
Code: Select all
martin@hopla:/data/custom/chartmagick/scripts$ perl test_dash.pl
ImageMagick 6.5.1-0 2009-08-27 Q16 OpenMP http://www.imagemagick.org
*** glibc detected *** perl: free(): invalid next size (fast): 0x09c3b158 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xd05ff1]
/lib/tls/i686/cmov/libc.so.6[0xd076f2]
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0xd0a79d]
/usr/lib/libMagickCore.so.2(RelinquishMagickMemory+0x22)[0x3b3ba2]
/usr/lib/libMagickCore.so.2(DestroyDrawInfo+0x158)[0x355a08]
/usr/lib/perl5/auto/Image/Magick/Magick.so(XS_Image__Magick_Mogrify+0x18cf)[0x146a9f]
perl(Perl_pp_entersub+0x570)[0x80b12c0]
perl(Perl_runops_standard+0x18)[0x80af688]
perl(perl_run+0x342)[0x80adbb2]
perl(main+0xed)[0x8063ffd]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0xcb1b56]
perl[0x8063e71]
======= Memory map: ========
00110000-00154000 r-xp 00000000 08:01 172077 /usr/lib/perl5/auto/Image/Magick/Magick.so
00154000-00155000 r--p 00043000 08:01 172077 /usr/lib/perl5/auto/Image/Magick/Magick.so
00155000-0015d000 rw-p 00044000 08:01 172077 /usr/lib/perl5/auto/Image/Magick/Magick.so
0015d000-0026c000 r-xp 00000000 08:01 605035 /usr/lib/libMagickWand.so.2.0.0
0026c000-0026d000 r--p 0010e000 08:01 605035 /usr/lib/libMagickWand.so.2.0.0
0026d000-0026f000 rw-p 0010f000 08:01 605035 /usr/lib/libMagickWand.so.2.0.0
0026f000-00291000 r-xp 00000000 08:01 108694 /usr/lib/libjpeg.so.62.0.0
00291000-00292000 r--p 00021000 08:01 108694 /usr/lib/libjpeg.so.62.0.0
00292000-00293000 rw-p 00022000 08:01 108694 /usr/lib/libjpeg.so.62.0.0
00293000-00295000 r-xp 00000000 08:01 109012 /usr/lib/libXau.so.6.0.0
00295000-00296000 r--p 00001000 08:01 109012 /usr/lib/libXau.so.6.0.0
00296000-00297000 rw-p 00002000 08:01 109012 /usr/lib/libXau.so.6.0.0
00297000-0029a000 r-xp 00000000 08:01 65571 /lib/libuuid.so.1.3.0
0029a000-0029b000 r--p 00002000 08:01 65571 /lib/libuuid.so.1.3.0
0029b000-0029c000 rw-p 00003000 08:01 65571 /lib/libuuid.so.1.3.0
0029c000-002b8000 r-xp 00000000 08:01 109015 /usr/lib/libxcb.so.1.1.0
002b8000-002b9000 r--p 0001c000 08:01 109015 /usr/lib/libxcb.so.1.1.0
002b9000-002ba000 rw-p 0001d000 08:01 109015 /usr/lib/libxcb.so.1.1.0
002bc000-002be000 r-xp 00000000 08:01 645911 /lib/tls/i686/cmov/libdl-2.10.1.so
002be000-002bf000 r--p 00001000 08:01 645911 /lib/tls/i686/cmov/libdl-2.10.1.so
002bf000-002c0000 rw-p 00002000 08:01 645911 /lib/tls/i686/cmov/libdl-2.10.1.so
002c0000-00492000 r-xp 00000000 08:01 115782 /usr/lib/libMagickCore.so.2.0.0
00492000-00497000 r--p 001d1000 08:01 115782 /usr/lib/libMagickCore.so.2.0.0
00497000-004dc000 rw-p 001d6000 08:01 115782 /usr/lib/libMagickCore.so.2.0.0
004dc000-004f4000 rw-p 00000000 00:00 0
004f4000-0056e000 r-xp 00000000 08:01 110048 /usr/lib/libfreetype.so.6.3.20
0056e000-00572000 r--p 00079000 08:01 110048 /usr/lib/libfreetype.so.6.3.20
00572000-00573000 rw-p 0007d000 08:01 110048 /usr/lib/libfreetype.so.6.3.20
00573000-006cc000 r-xp 00000000 08:01 107630 /usr/lib/libperl.so.5.10.0
006cc000-006ce000 r--p 00159000 08:01 107630 /usr/lib/libperl.so.5.10.0
006ce000-006d1000 rw-p 0015b000 08:01 107630 /usr/lib/libperl.so.5.10.0
006d1000-00727000 r-xp 00000000 08:01 106487 /usr/lib/libtiff.so.4.2.1
00727000-00729000 r--p 00055000 08:01 106487 /usr/lib/libtiff.so.4.2.1
00729000-0072a000 rw-p 00057000 08:01 106487 /usr/lib/libtiff.so.4.2.1
00777000-0078e000 r-xp 00000000 08:01 108427 /usr/lib/libICE.so.6.3.0
0078e000-0078f000 r--p 00016000 08:01 108427 /usr/lib/libICE.so.6.3.0
0078f000-00790000 rw-p 00017000 08:01 108427 /usr/lib/libICE.so.6.3.0
00790000-00792000 rw-p 00000000 00:00 0
007b3000-007ba000 r-xp 00000000 08:01 106346 /usr/lib/libSM.so.6.0.0
007ba000-007bb000 r--p 00006000 08:01 106346 /usr/lib/libSM.so.6.0.0
007bb000-007bc000 rw-p 00007000 08:01 106346 /usr/lib/libSM.so.6.0.0
007c9000-007dd000 r-xp 00000000 08:01 65709 /lib/libz.so.1.2.3.3
007dd000-007de000 r--p 00013000 08:01 65709 /lib/libz.so.1.2.3.3
007de000-007df000 rw-p 00014000 08:01 65709 /lib/libz.so.1.2.3.3
007df000-0082e000 r-xp 00000000 08:01 106488 /usr/lib/libXt.so.6.0.0
0082e000-0082f000 r--p 0004f000 08:01 106488 /usr/lib/libXt.so.6.0.0
0082f000-00832000 rw-p 00050000 08:01 106488 /usr/lib/libXt.so.6.0.0
00890000-008c0000 r-xp 00000000 08:01 109218 /usr/lib/liblcms.so.1.0.18
008c0000-008c1000 r--p 0002f000 08:01 109218 /usr/lib/liblcms.so.1.0.18
008c1000-008c2000 rw-p 00030000 08:01 109218 /usr/lib/liblcms.so.1.0.18
008c2000-008c4000 rw-p 00000000 00:00 0
008c4000-009ee000 r-xp 00000000 08:01 106603 /usr/lib/libX11.so.6.2.0
009ee000-009ef000 ---p 0012a000 08:01 106603 /usr/lib/libX11.so.6.2.0
009ef000-009f0000 r--p 0012a000 08:01 106603 /usr/lib/libX11.so.6.2.0
009f0000-009f2000 rw-p 0012b000 08:01 106603 /usr/lib/libX11.so.6.2.0
009f2000-009f3000 rw-p 00000000 00:00 0
009fc000-00a08000 r-xp 00000000 08:01 107420 /usr/lib/libgomp.so.1.0.0
00a08000-00a09000 r--p 0000b000 08:01 107420 /usr/lib/libgomp.so.1.0.0
00a09000-00a0a000 rw-p 0000c000 08:01 107420 /usr/lib/libgomp.so.1.0.0
00a1b000-00a2b000 r-xp 00000000 08:01 65781 /lib/libbz2.so.1.0.4
00a2b000-00a2c000 r--p 0000f000 08:01 65781 /lib/libbz2.so.1.0.4
00a2c000-00a2d000 rw-p 00010000 08:01 65781 /lib/libbz2.so.1.0.4
00a32000-00a40000 r-xp 00000000 08:01 106290 /usr/lib/libXext.so.6.4.0
00a40000-00a41000 r--p 0000d000 08:01 106290 /usr/lib/libXext.so.6.4.0
00a41000-00a42000 rw-p 0000e000 08:01 106290 /usr/lib/libXext.so.6.4.0
00aa7000-00abc000 r-xp 00000000 08:01 645922 /lib/tls/i686/cmov/libpthread-2.10.1.so
00abc000-00abd000 r--p 00014000 08:01 645922 /lib/tls/i686/cmov/libpthread-2.10.1.so
00abd000-00abe000 rw-p 00015000 08:01 645922 /lib/tls/i686/cmov/libpthread-2.10.1.so
00abe000-00ac0000 rw-p 00000000 00:00 0
00ad5000-00add000 r-xp 00000000 08:01 107423 /usr/lib/libltdl.so.7.2.0
00add000-00ade000 r--p 00007000 08:01 107423 /usr/lib/libltdl.so.7.2.0
00ade000-00adf000 rw-p 00008000 08:01 107423 /usr/lib/libltdl.so.7.2.0
00afd000-00b21000 r-xp 00000000 08:01 645912 /lib/tls/i686/cmov/libm-2.10.1.so
00b21000-00b22000 r--p 00023000 08:01 645912 /lib/tls/i686/cmov/libm-2.10.1.so
00b22000-00b23000 rw-p 00024000 08:01 645912 /lib/tls/i686/cmov/libm-2.10.1.so
00b3f000-00b5b000 r-xp 00000000 08:01 65413 /lib/libgcc_s.so.1
00b5b000-00b5c000 r--p 0001b000 08:01 65413 /lib/libgcc_s.so.1
00b5c000-00b5d000 rw-p 0001c000 08:01 65413 /lib/libgcc_s.so.1
00c4f000-00c56000 r-xp 00000000 08:01 645924 /lib/tls/i686/cmov/librt-2.10.1.so
00c56000-00c57000 r--p 00006000 08:01 645924 /lib/tls/i686/cmov/librt-2.10.1.so
00c57000-00c58000 rw-p 00007000 08:01 645924 /lib/tls/i686/cmov/librt-2.10.1.so
00c5c000-00c77000 r-xp 00000000 08:01 70861 /lib/ld-2.10.1.so
00c77000-00c78000 r--p 0001a0Aborted
martin@hopla:/data/custom/chartmagick/scripts$
Code: Select all
martin@hopla:/data/custom/chartmagick/scripts$ export MALLOC_CHECK_=1
martin@hopla:/data/custom/chartmagick/scripts$ perl test_dash.pl
ImageMagick 6.5.1-0 2009-08-27 Q16 OpenMP http://www.imagemagick.org
*** glibc detected *** perl: free(): invalid pointer: 0x08d94f80 ***
martin@hopla:/data/custom/chartmagick/scripts$
Code: Select all
martin@hopla:/data/custom/chartmagick/scripts$ perl test_dash.pl
ImageMagick 6.5.7-10 2009-11-25 Q16 http://www.imagemagick.org
*** glibc detected *** perl: free(): invalid next size (fast): 0x0840c290 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0x17aff1]
/lib/tls/i686/cmov/libc.so.6[0x17c6f2]
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x17f79d]
/data/wre/prereqs/lib/libMagickCore.so.2(RelinquishMagickMemory+0x22)[0x469332]
/data/wre/prereqs/lib/libMagickCore.so.2(DestroyDrawInfo+0x158)[0x4046d8]
/data/wre/prereqs/lib/perl5/site_perl/5.10.1/i686-linux/auto/Image/Magick/Magick.so(XS_Image__Magick_Mogrify+0x5e34)[0xc36fb4]
perl(Perl_pp_entersub+0x592)[0x80c76f2]
perl(Perl_runops_standard+0x13)[0x80c5c43]
perl(perl_run+0x2bd)[0x807715d]
perl(main+0xc5)[0x80628e5]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x126b56]
perl[0x8062781]
======= Memory map: ========
00110000-0024e000 r-xp 00000000 08:01 645908 /lib/tls/i686/cmov/libc-2.10.1.so
0024e000-00250000 r--p 0013e000 08:01 645908 /lib/tls/i686/cmov/libc-2.10.1.so
00250000-00251000 rw-p 00140000 08:01 645908 /lib/tls/i686/cmov/libc-2.10.1.so
00251000-00254000 rw-p 00000000 00:00 0
00254000-00284000 r-xp 00000000 08:01 12818 /data/wre/prereqs/lib/liblcms.so.1.0.18
00284000-00285000 r--p 0002f000 08:01 12818 /data/wre/prereqs/lib/liblcms.so.1.0.18
00285000-00286000 rw-p 00030000 08:01 12818 /data/wre/prereqs/lib/liblcms.so.1.0.18
00286000-00288000 rw-p 00000000 00:00 0
00288000-002d1000 r-xp 00000000 08:01 12846 /data/wre/prereqs/lib/libtiff.so.3.8.2
002d1000-002d3000 r--p 00048000 08:01 12846 /data/wre/prereqs/lib/libtiff.so.3.8.2
002d3000-002d4000 rw-p 0004a000 08:01 12846 /data/wre/prereqs/lib/libtiff.so.3.8.2
002ea000-0035f000 r-xp 00000000 08:01 12861 /data/wre/prereqs/lib/libfreetype.so.6.3.22
0035f000-00363000 r--p 00075000 08:01 12861 /data/wre/prereqs/lib/libfreetype.so.6.3.22
00363000-00364000 rw-p 00079000 08:01 12861 /data/wre/prereqs/lib/libfreetype.so.6.3.22
00364000-00379000 r-xp 00000000 08:01 645922 /lib/tls/i686/cmov/libpthread-2.10.1.so
00379000-0037a000 r--p 00014000 08:01 645922 /lib/tls/i686/cmov/libpthread-2.10.1.so
0037a000-0037b000 rw-p 00015000 08:01 645922 /lib/tls/i686/cmov/libpthread-2.10.1.so
0037b000-0037d000 rw-p 00000000 00:00 0
0038d000-004fc000 r-xp 00000000 08:01 12814 /data/wre/prereqs/lib/libMagickCore.so.2.0.1
004fc000-00506000 r--p 0016e000 08:01 12814 /data/wre/prereqs/lib/libMagickCore.so.2.0.1
00506000-0050c000 rw-p 00178000 08:01 12814 /data/wre/prereqs/lib/libMagickCore.so.2.0.1
0050c000-0053f000 r-xp 00000000 08:01 12917 /data/wre/prereqs/lib/libjpeg.so.7.0.0
0053f000-00540000 ---p 00033000 08:01 12917 /data/wre/prereqs/lib/libjpeg.so.7.0.0
00540000-00541000 r--p 00033000 08:01 12917 /data/wre/prereqs/lib/libjpeg.so.7.0.0
00541000-00542000 rw-p 00034000 08:01 12917 /data/wre/prereqs/lib/libjpeg.so.7.0.0
0054b000-00552000 r-xp 00000000 08:01 645924 /lib/tls/i686/cmov/librt-2.10.1.so
00552000-00553000 r--p 00006000 08:01 645924 /lib/tls/i686/cmov/librt-2.10.1.so
00553000-00554000 rw-p 00007000 08:01 645924 /lib/tls/i686/cmov/librt-2.10.1.so
00554000-00570000 r-xp 00000000 08:01 65413 /lib/libgcc_s.so.1
00570000-00571000 r--p 0001b000 08:01 65413 /lib/libgcc_s.so.1
00571000-00572000 rw-p 0001c000 08:01 65413 /lib/libgcc_s.so.1
00594000-00596000 r-xp 00000000 08:01 645911 /lib/tls/i686/cmov/libdl-2.10.1.so
00596000-00597000 r--p 00001000 08:01 645911 /lib/tls/i686/cmov/libdl-2.10.1.so
00597000-00598000 rw-p 00002000 08:01 645911 /lib/tls/i686/cmov/libdl-2.10.1.so
0074b000-00754000 r-xp 00000000 08:01 645910 /lib/tls/i686/cmov/libcrypt-2.10.1.so
00754000-00755000 r--p 00008000 08:01 645910 /lib/tls/i686/cmov/libcrypt-2.10.1.so
00755000-00756000 rw-p 00009000 08:01 645910 /lib/tls/i686/cmov/libcrypt-2.10.1.so
00756000-0077d000 rw-p 00000000 00:00 0
0077e000-00799000 r-xp 00000000 08:01 70861 /lib/ld-2.10.1.so
00799000-0079a000 r--p 0001a000 08:01 70861 /lib/ld-2.10.1.so
0079a000-0079b000 rw-p 0001b000 08:01 70861 /lib/ld-2.10.1.so
009da000-009e6000 r-xp 00000000 08:01 107420 /usr/lib/libgomp.so.1.0.0
009e6000-009e7000 r--p 0000b000 08:01 107420 /usr/lib/libgomp.so.1.0.0
009e7000-009e8000 rw-p 0000c000 08:01 107420 /usr/lib/libgomp.so.1.0.0
00a36000-00a49000 r-xp 00000000 08:01 12909 /data/wre/prereqs/lib/libz.so.1.2.3
00a49000-00a4a000 r--p 00012000 08:01 12909 /data/wre/prereqs/lib/libz.so.1.2.3
00a4a000-00a4b000 rw-p 00013000 08:01 12909 /data/wre/prereqs/lib/libz.so.1.2.3
00aa2000-00aa3000 r-xp 00000000 08:01 510334 /data/wre/prereqs/lib/ImageMagick-6.5.7/modules-Q16/coders/xc.so
00aa3000-00aa4000 r--p 00001000 08:01 510334 /data/wre/prereqs/lib/ImageMagick-6.5.7/modules-Q16/coders/xc.so
00aa4000-00aa5000 rw-p 00002000 08:01 510334 /data/wre/prereqs/lib/ImageMagick-6.5.7/modules-Q16/coders/xc.so
00c02000-00c3f000 r-xp 00000000 08:01 696572 /data/wre/prereqs/lib/perl5/site_perl/5.10.1/i686-linux/auto/Image/Magick/Magick.so
00c3f000-00c40000 r--p 0003c000 08:01 696572 /data/wre/prereqs/lib/perl5/site_perl/5.10.1/i686-linux/auto/Image/Magick/Magick.so
00c40000-00c49000 rw-p 0003d000 08:01 696572 /data/wre/prereqs/lib/perl5/site_perl/5.10.1/i686-linux/auto/Image/Magick/Magick.so
00cef000-00d13000 r-xp 00000000 08:01 645912 /lib/tls/i686/cmov/libm-2.10.1.so
00d13000-00d14000 r--p 00023000 08:01 645912 /lib/tls/i686/cmov/libm-2.10.1.so
00d14000-00d15000 rw-p 00024000 08:01 645912 /lib/tls/i686/cmov/libm-2.10.1.so
00dae000-00db0000 r-xp 00000000 08:01 645927 /lib/tls/i686/cmov/libutil-2.10.1.so
00db0000-00db1000 r--p 00001000 08:01 645927 /lib/tls/i686/cmov/libutil-2.10.1.so
00db1000-00db2000 rw-p 00002000 08:01 645927 /lib/tls/i686/cmov/libutil-2.10.1.so
00dcc000-00dd4000 r-xp 00000000 08:01 12830 /data/wre/prereqs/lib/libltdl.so.7.2.0
00dd4000-00dd5000 r--p 00007000 08:01 12830 /data/wre/prereqs/lib/libltdl.so.7.2.0
00dd5000-00dd6000 rw-p 00008000 08:01 12830 /data/wre/prereqs/lib/libltdl.so.7.2.0
00ded000-00dee000 r-xp 00000000 00:00 0 [vdso]
00eaf000-00ec2000 r-xp 00000000 08:01 645914 /lib/tls/i686/cmov/libnsl-2.10.1.so
00ec2000-00ec3000 r--p 00012000 08:01 645914 /lib/tls/i686/cmov/libnsl-2.10.1.so
00ec3000-00ec4000 rw-p 00013000 08:01 645914 /lib/tls/i686/cmov/libnsl-2.10.1.so
00ec4000-00ec6000 rw-p 00000000 00:00 0
08048000-08154000 r-xp 00000000 08:01 11234 /data/wre/prereqs/bin/perlAborted
martin@hopla:/data/custom/chartmagick/scripts$
With MALLOC_CHECK_=1 exported into the envronment, the following gets output:
Code: Select all
martin@hopla:/data/custom/chartmagick/scripts$ export MALLOC_CHECK_=1
martin@hopla:/data/custom/chartmagick/scripts$ perl test_dash.pl
ImageMagick 6.5.7-10 2009-11-25 Q16 http://www.imagemagick.org
*** glibc detected *** perl: free(): invalid pointer: 0x08f53160 ***
*** glibc detected *** perl: free(): invalid pointer: 0x08f53180 ***
Segmentation fault
martin@hopla:/data/custom/chartmagick/scripts$
Related to this issue I found this, which may be of help: http://studio.imagemagick.org/pipermail ... 20888.html
If you need any additional information, or any other tests I can perform, please let me know.
Regards,
Martin Kamerbeek
http://www.oqapi.nl