Page 1 of 1

bug with mogrify

Posted: 2013-04-25T21:39:46-07:00
by idsp
I use ImageMagick to re-sample and then thumbnail images. Occasionally I get an image that core dumps on mogrify
Some debugging info below.

Image in question is http://tinyurl.com/coaxlue

it fails on

mogrify -path thumbs -thumbnail 250x60 -unsharp 0x.5 Telacu.jpg
mogrify -path l_thumbs -thumbnail 1200x160 -unsharp 0x.5 Telacu.jpg

but works on

mogrify -path . -strip -adaptive-resize 1000x300 Telacu.jpg


Thanks,

Steve


[root@ 340]# uname -a
Linux 2.6.32-220.4.1.el6.i686 #1 SMP Mon Jan 23 22:37:12 GMT 2012 i686 i686 i386 GNU/Linux
[root@ 340]# cat /etc/redhat-release
CentOS release 6.2 (Final)

[root@ 340]# rpm -qa | grep glibc
glibc-2.12-1.107.el6.i686
glibc-headers-2.12-1.107.el6.i686
glibc-devel-2.12-1.107.el6.i686
glibc-common-2.12-1.107.el6.i686
[root@ 340]# rpm -qa | grep ImageMagick
ImageMagick-6.5.4.7-6.el6_2.i686
ImageMagick-perl-6.5.4.7-6.el6_2.i686


[root@ 340]# identify Telacu.jpg
Telacu.jpg JPEG 352x300 352x300+0+0 8-bit DirectClass 23.6kb


[root@ 340]# mogrify -path l_thumbs -thumbnail 1200x160 -unsharp 0x.5 Telacu.jpg
*** glibc detected *** mogrify: free(): invalid next size (fast): 0x09cd5340 ***
======= Backtrace: =========
/lib/i686/nosegneg/libc.so.6(+0x71c21)[0x6aac21]
/lib/i686/nosegneg/libc.so.6(+0x74371)[0x6ad371]
/usr/lib/libMagickCore.so.2(RelinquishAlignedMemory+0x22)[0xccfec2]
/usr/lib/libMagickCore.so.2(DestroyPixelCacheNexus+0x7d)[0xc0929d]
/usr/lib/libMagickCore.so.2(GetVirtualPixelsFromNexus+0x3ff)[0xc0a8df]
/usr/lib/libMagickCore.so.2(GetCacheViewVirtualPixels+0x7f)[0xc1104f]
/usr/lib/libMagickCore.so.2(+0xb612e)[0xc8a12e]
/usr/lib/libMagickCore.so.2(BlurImageChannel+0x4e2)[0xc8aeb2]
/usr/lib/libMagickCore.so.2(UnsharpMaskImageChannel+0x82)[0xc8b302]
/usr/lib/libMagickWand.so.2(MogrifyImage+0x25cd)[0xa08a1d]
/usr/lib/libMagickWand.so.2(MogrifyImages+0x165)[0xa0e655]
/usr/lib/libMagickWand.so.2(MogrifyImageCommand+0x971)[0xa0f1c1]
mogrify[0x8048ad1]
/lib/i686/nosegneg/libc.so.6(__libc_start_main+0xe6)[0x64fce6]
mogrify[0x8048901]
======= Memory map: ========
00110000-00169000 r-xp 00000000 ca:41 20396 /usr/lib/libXt.so.6.0.0
00169000-0016d000 rw-p 00058000 ca:41 20396 /usr/lib/libXt.so.6.0.0
0016d000-0017f000 r-xp 00000000 ca:41 132309 /lib/libz.so.1.2.3
0017f000-00180000 r--p 00011000 ca:41 132309 /lib/libz.so.1.2.3
00180000-00181000 rw-p 00012000 ca:41 132309 /lib/libz.so.1.2.3
00181000-0018f000 r-xp 00000000 ca:41 21701 /usr/lib/libgomp.so.1.0.0
0018f000-00190000 rw-p 0000d000 ca:41 21701 /usr/lib/libgomp.so.1.0.0
00190000-001b8000 r-xp 00000000 ca:41 131551 /lib/libm-2.12.so
001b8000-001b9000 r--p 00027000 ca:41 131551 /lib/libm-2.12.so
001b9000-001ba000 rw-p 00028000 ca:41 131551 /lib/libm-2.12.so
001ba000-001d7000 r-xp 00000000 ca:41 132313 /lib/libgcc_s-4.4.6-20110824.so.1
001d7000-001d8000 rw-p 0001d000 ca:41 132313 /lib/libgcc_s-4.4.6-20110824.so.1
001d8000-001fe000 r-xp 00000000 ca:41 132318 /lib/libexpat.so.1.5.2
001fe000-00200000 rw-p 00025000 ca:41 132318 /lib/libexpat.so.1.5.2
00200000-00207000 r-xp 00000000 ca:41 131842 /lib/librt-2.12.so
00207000-00208000 r--p 00006000 ca:41 131842 /lib/librt-2.12.so
00208000-00209000 rw-p 00007000 ca:41 131842 /lib/librt-2.12.so
00209000-0020c000 r-xp 00000000 ca:41 131545 /lib/libdl-2.12.so
0020c000-0020d000 r--p 00002000 ca:41 131545 /lib/libdl-2.12.so
0020d000-0020e000 rw-p 00003000 ca:41 131545 /lib/libdl-2.12.so
0020e000-0022b000 r-xp 00000000 ca:41 1290 /usr/lib/libxcb.so.1.1.0
0022b000-0022c000 rw-p 0001c000 ca:41 1290 /usr/lib/libxcb.so.1.1.0
0022c000-0022e000 r-xp 00000000 ca:41 1335 /usr/lib/libXau.so.6.0.0
0022e000-0022f000 rw-p 00001000 ca:41 1335 /usr/lib/libXau.so.6.0.0
0022f000-00238000 r-xp 00000000 ca:41 22532 /usr/lib/ImageMagick-6.5.4/modules-Q16/coders/jpeg.so
00238000-00239000 rw-p 00008000 ca:41 22532 /usr/lib/ImageMagick-6.5.4/modules-Q16/coders/jpeg.so
00322000-00340000 r-xp 00000000 ca:41 132069 /lib/ld-2.12.so
00340000-00341000 r--p 0001d000 ca:41 132069 /lib/ld-2.12.so
00341000-00342000 rw-p 0001e000 ca:41 132069 /lib/ld-2.12.so
0034f000-00350000 r-xp 00000000 00:00 0 [vdso]
003d6000-0046a000 r-xp 00000000 ca:41 48290 /usr/lib/libfreetype.so.6.3.22
0046a000-0046e000 rw-p 00094000 ca:41 48290 /usr/lib/libfreetype.so.6.3.22
004ca000-004fd000 r-xp 00000000 ca:41 248 /usr/lib/libfontconfig.so.1.4.4
004fd000-004ff000 rw-p 00032000 ca:41 248 /usr/lib/libfontconfig.so.1.4.4
00501000-00635000 r-xp 00000000 ca:41 1469 /usr/lib/libX11.so.6.3.0
00635000-00639000 rw-p 00133000 ca:41 1469 /usr/lib/libX11.so.6.3.0
00639000-007cd000 r-xp 00000000 ca:41 131746 /lib/i686/nosegneg/libc-2.12.so
007cd000-007cf000 r--p 00194000 ca:41 131746 /lib/i686/nosegneg/libc-2.12.so
007cf000-007d0000 rw-p 00196000 ca:41 131746 /lib/i686/nosegneg/libc-2.12.so
007d0000-007d3000 rw-p 00000000 00:00 0
00955000-00a6a000 r-xp 00000000 ca:41 22679 /usr/lib/libMagickWand.so.2.0.0
00a6a000-00a6c000 rw-p 00114000 ca:41 22679 /usr/lib/libMagickWand.so.2.0.0
00a7b000-00a84000 r-xp 00000000 ca:41 20780 /usr/lib/libltdl.so.7.2.1
00a84000-00a85000 rw-p 00008000 ca:41 20780 /usr/lib/libltdl.so.7.2.1
00a8b000-00aad000 r-xp 00000000 ca:41 1186 /usr/lib/libjpeg.so.62.0.0
00aad000-00aae000 rw-p 00022000 ca:41 1186 /usr/lib/libjpeg.so.62.0.0
00ab0000-00b10000 r-xp 00000000 ca:41 1380 /usr/lib/libtiff.so.3.9.4
00b10000-00b12000 rw-p 00060000 ca:41 1380 /usr/lib/libtiff.so.3.9.4
00b14000-00b4a000 r-xp 00000000 ca:41 449 /usr/lib/liblcms.so.1.0.19
00b4a000-00b4c000 rw-p 00035000 ca:41 449 /usr/lib/liblcms.so.1.0.19
00b4c000-00b4e000 rw-p 00000000 00:00 0
00b50000-00b67000 r-xp 00000000 ca:41 1294 /usr/lib/libICE.so.6.3.0
00b67000-00b69000 rw-p 00016000 ca:41 1294 /usr/lib/libICE.so.6.3.0
00b69000-00b6a000 rw-p 00000000 00:00 0
00b6c000-00b73000 r-xp 00000000 ca:41 20390 /usr/lib/libSM.so.6.0.0
00b73000-00b74000 rw-p 00006000 ca:41 20390 /usr/lib/libSM.so.6.0.0
00b76000-00b7a000 r-xp 00000000 ca:41 132304 /lib/libuuid.so.1.3.0
00b7a000-00b7b000 rw-p 00003000 ca:41 132304 /lib/libuuid.so.1.3.0
00b92000-00ba2000 r-xp 00000000 ca:41 132317 /lib/libbz2.so.1.0.4
00ba2000-00ba3000 rw-p 00010000 ca:41 132317 /lib/libbz2.so.1.0.4
00ba5000-00bb5000 r-xp 00000000 ca:41 22437 /usr/lib/libXext.so.6.4.0
00bb5000-00bb6000 rw-p 00010000 ca:41 22437 /usr/lib/libXext.so.6.4.0
00bd4000-00db6000 r-xp 00000000 ca:41 22677 /usr/lib/libMagickCore.so.2.0.0
00db6000-00e00000 rw-p 001e2000 ca:41 22677 /usr/lib/libMagickCore.so.2.0.0
00e00000-00e18000 rw-p 00000000 00:00 0
00e1d000-00e34000 r-xp 00000000 ca:41 132064 /lib/i686/nosegneg/libpthread-2.12.so
00e34000-00e35000 r--p 00016000 ca:41 132064 /lib/i686/nosegneg/libpthread-2.12.so
00e35000-00e36000 rw-p 00017000 ca:41 132064 /lib/i686/nosegneg/libpthread-2.12.so
00e36000-00e38000 rw-p 00000000 00:00 0
08048000-08049000 r-xp 00000000 ca:41 1070 /usr/bin/mogrify
08049000-0804a000 rw-p 00001000 ca:41 1070 /usr/bin/mogrify
09cb4000-09cf2000 rw-p 00000000 00:00 0 [heap]
b75ef000-b7639000 rw-p 00000000 00:00 0
b76f0000-b7742000 rw-p 00000000 00:00 0
b774a000-b774b000 rw-p 00000000 00:00 0
bf9a3000-bf9bc000 rw-p 00000000 00:00 0 [stack]
Aborted (core dumped)

[root@ 340]# mogrify -path thumbs -thumbnail 250x60 -unsharp 0x.5 Telacu.jpg
*** glibc detected *** mogrify: double free or corruption (!prev): 0x084c2680 ***
======= Backtrace: =========
/lib/i686/nosegneg/libc.so.6(+0x71c21)[0x7acc21]
/lib/i686/nosegneg/libc.so.6(+0x74371)[0x7af371]
/usr/lib/libMagickCore.so.2(RelinquishMagickMemory+0x23)[0xc02dd3]
/usr/lib/libMagickCore.so.2(DestroyPixelCacheNexus+0xa6)[0xb3c2c6]
/usr/lib/libMagickCore.so.2(DestroyCacheView+0x49)[0xb44ba9]
/usr/lib/libMagickCore.so.2(BlurImageChannel+0x525)[0xbbdef5]
/usr/lib/libMagickCore.so.2(UnsharpMaskImageChannel+0x82)[0xbbe302]
/usr/lib/libMagickWand.so.2(MogrifyImage+0x25cd)[0xf0aa1d]
/usr/lib/libMagickWand.so.2(MogrifyImages+0x165)[0xf10655]
/usr/lib/libMagickWand.so.2(MogrifyImageCommand+0x971)[0xf111c1]
mogrify[0x8048ad1]
/lib/i686/nosegneg/libc.so.6(__libc_start_main+0xe6)[0x751ce6]
mogrify[0x8048901]
======= Memory map: ========
00110000-00146000 r-xp 00000000 ca:41 449 /usr/lib/liblcms.so.1.0.19
00146000-00148000 rw-p 00035000 ca:41 449 /usr/lib/liblcms.so.1.0.19
00148000-0014a000 rw-p 00000000 00:00 0
0014a000-001aa000 r-xp 00000000 ca:41 1380 /usr/lib/libtiff.so.3.9.4
001aa000-001ac000 rw-p 00060000 ca:41 1380 /usr/lib/libtiff.so.3.9.4
001ac000-001bc000 r-xp 00000000 ca:41 22437 /usr/lib/libXext.so.6.4.0
001bc000-001bd000 rw-p 00010000 ca:41 22437 /usr/lib/libXext.so.6.4.0
001bd000-00216000 r-xp 00000000 ca:41 20396 /usr/lib/libXt.so.6.0.0
00216000-0021a000 rw-p 00058000 ca:41 20396 /usr/lib/libXt.so.6.0.0
0021a000-0022a000 r-xp 00000000 ca:41 132317 /lib/libbz2.so.1.0.4
0022a000-0022b000 rw-p 00010000 ca:41 132317 /lib/libbz2.so.1.0.4
0022b000-00242000 r-xp 00000000 ca:41 132064 /lib/i686/nosegneg/libpthread-2.12.so
00242000-00243000 r--p 00016000 ca:41 132064 /lib/i686/nosegneg/libpthread-2.12.so
00243000-00244000 rw-p 00017000 ca:41 132064 /lib/i686/nosegneg/libpthread-2.12.so
00244000-00246000 rw-p 00000000 00:00 0
00246000-0024d000 r-xp 00000000 ca:41 20390 /usr/lib/libSM.so.6.0.0
0024d000-0024e000 rw-p 00006000 ca:41 20390 /usr/lib/libSM.so.6.0.0
0024e000-00265000 r-xp 00000000 ca:41 1294 /usr/lib/libICE.so.6.3.0
00265000-00267000 rw-p 00016000 ca:41 1294 /usr/lib/libICE.so.6.3.0
00267000-00268000 rw-p 00000000 00:00 0
00268000-00285000 r-xp 00000000 ca:41 132313 /lib/libgcc_s-4.4.6-20110824.so.1
00285000-00286000 rw-p 0001d000 ca:41 132313 /lib/libgcc_s-4.4.6-20110824.so.1
00286000-002ac000 r-xp 00000000 ca:41 132318 /lib/libexpat.so.1.5.2
002ac000-002ae000 rw-p 00025000 ca:41 132318 /lib/libexpat.so.1.5.2
002ae000-002b5000 r-xp 00000000 ca:41 131842 /lib/librt-2.12.so
002b5000-002b6000 r--p 00006000 ca:41 131842 /lib/librt-2.12.so
002b6000-002b7000 rw-p 00007000 ca:41 131842 /lib/librt-2.12.so
002b7000-002bb000 r-xp 00000000 ca:41 132304 /lib/libuuid.so.1.3.0
002bb000-002bc000 rw-p 00003000 ca:41 132304 /lib/libuuid.so.1.3.0
002bc000-002c5000 r-xp 00000000 ca:41 22532 /usr/lib/ImageMagick-6.5.4/modules-Q16/coders/jpeg.so
002c5000-002c6000 rw-p 00008000 ca:41 22532 /usr/lib/ImageMagick-6.5.4/modules-Q16/coders/jpeg.so
003d6000-0046a000 r-xp 00000000 ca:41 48290 /usr/lib/libfreetype.so.6.3.22
0046a000-0046e000 rw-p 00094000 ca:41 48290 /usr/lib/libfreetype.so.6.3.22
004ca000-004fd000 r-xp 00000000 ca:41 248 /usr/lib/libfontconfig.so.1.4.4
004fd000-004ff000 rw-p 00032000 ca:41 248 /usr/lib/libfontconfig.so.1.4.4
00501000-00635000 r-xp 00000000 ca:41 1469 /usr/lib/libX11.so.6.3.0
00635000-00639000 rw-p 00133000 ca:41 1469 /usr/lib/libX11.so.6.3.0
0063b000-0063d000 r-xp 00000000 ca:41 1335 /usr/lib/libXau.so.6.0.0
0063d000-0063e000 rw-p 00001000 ca:41 1335 /usr/lib/libXau.so.6.0.0
00708000-0070b000 r-xp 00000000 ca:41 131545 /lib/libdl-2.12.so
0070b000-0070c000 r--p 00002000 ca:41 131545 /lib/libdl-2.12.so
0070c000-0070d000 rw-p 00003000 ca:41 131545 /lib/libdl-2.12.so
0071b000-00739000 r-xp 00000000 ca:41 132069 /lib/ld-2.12.so
00739000-0073a000 r--p 0001d000 ca:41 132069 /lib/ld-2.12.so
0073a000-0073b000 rw-p 0001e000 ca:41 132069 /lib/ld-2.12.so
0073b000-008cf000 r-xp 00000000 ca:41 131746 /lib/i686/nosegneg/libc-2.12.so
008cf000-008d1000 r--p 00194000 ca:41 131746 /lib/i686/nosegneg/libc-2.12.so
008d1000-008d2000 rw-p 00196000 ca:41 131746 /lib/i686/nosegneg/libc-2.12.so
008d2000-008d5000 rw-p 00000000 00:00 0
009fe000-009ff000 r-xp 00000000 00:00 0 [vdso]
00a1d000-00a45000 r-xp 00000000 ca:41 131551 /lib/libm-2.12.so
00a45000-00a46000 r--p 00027000 ca:41 131551 /lib/libm-2.12.so
00a46000-00a47000 rw-p 00028000 ca:41 131551 /lib/libm-2.12.so
00a49000-00a5b000 r-xp 00000000 ca:41 132309 /lib/libz.so.1.2.3
00a5b000-00a5c000 r--p 00011000 ca:41 132309 /lib/libz.so.1.2.3
00a5c000-00a5d000 rw-p 00012000 ca:41 132309 /lib/libz.so.1.2.3
00a6a000-00a78000 r-xp 00000000 ca:41 21701 /usr/lib/libgomp.so.1.0.0
00a78000-00a79000 rw-p 0000d000 ca:41 21701 /usr/lib/libgomp.so.1.0.0
00a7b000-00a84000 r-xp 00000000 ca:41 20780 /usr/lib/libltdl.so.7.2.1
00a84000-00a85000 rw-p 00008000 ca:41 20780 /usr/lib/libltdl.so.7.2.1
00a8b000-00aad000 r-xp 00000000 ca:41 1186 /usr/lib/libjpeg.so.62.0.0
00aad000-00aae000 rw-p 00022000 ca:41 1186 /usr/lib/libjpeg.so.62.0.0
00b07000-00ce9000 r-xp 00000000 ca:41 22677 /usr/lib/libMagickCore.so.2.0.0
00ce9000-00d33000 rw-p 001e2000 ca:41 22677 /usr/lib/libMagickCore.so.2.0.0
00d33000-00d4b000 rw-p 00000000 00:00 0
00ddd000-00dfa000 r-xp 00000000 ca:41 1290 /usr/lib/libxcb.so.1.1.0
00dfa000-00dfb000 rw-p 0001c000 ca:41 1290 /usr/lib/libxcb.so.1.1.0
00e57000-00f6c000 r-xp 00000000 ca:41 22679 /usr/lib/libMagickWand.so.2.0.0
00f6c000-00f6e000 rw-p 00114000 ca:41 22679 /usr/lib/libMagickWand.so.2.0.0
08048000-08049000 r-xp 00000000 ca:41 1070 /usr/bin/mogrify
08049000-0804a000 rw-p 00001000 ca:41 1070 /usr/bin/mogrify
084aa000-084eb000 rw-p 00000000 00:00 0 [heap]
b7805000-b780d000 rw-p 00000000 00:00 0
b7815000-b7816000 rw-p 00000000 00:00 0
bfc44000-bfc5d000 rw-p 00000000 00:00 0 [stack]
Aborted (core dumped)

[root@ 340]# mogrify -path . -strip -adaptive-resize 1000x300 Telacu.jpg
[root@ 340]# identify Telacu.jpg
Telacu.jpg JPEG 352x300 352x300+0+0 8-bit DirectClass 23.9kb

Re: bug with mogrify

Posted: 2013-04-26T04:11:32-07:00
by magick
We tried your commands and image with ImageMagick 6.8.5-1, the current release, and they completed without complaint. You may need to upgrade your release of ImageMagick.