Page 1 of 1

Wild pointer -> trunk crashing on my task; with valgrind log

Posted: 2013-08-15T23:03:55-07:00
by DanKegel
On Ubuntu 13.04, I did

$ PREFIX=$HOME/foo
$ mkdir $PREFIX
$ wget http://kegel.com/imagemagick/slow/slow.jpg
$ svn co https://www.imagemagick.org/subversion/ ... gick/trunk ImageMagick
$ cd ImageMagick
$ svn info
...
Revision: 13007
$ ./configure --prefix $PREFIX --with-modules --without-perl
$ make -j5
$ make install
$ PATH=$PREFIX/bin:$PATH
$ convert ../slow.jpg -depth 8 -auto-orient -strip -type TrueColorMatte -write PNG32:/tmp/img-conf.png '(' +clone -strip -resize 480x480 -write PNG32:/tmp/img-thumb.png +delete ')' -background 'rgba(255,255,255,.06)' -gravity center -resize 1920x1080 -extent 1920x1080 -write /tmp/img-slide.png -resize 480x270 -write /tmp/img-thumb-480x270.png -resize 160x90 /tmp/img-thumb-160x90.png

This crashed with

*** Error in `convert': munmap_chunk(): invalid pointer: 0x00007ff442902b4a ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7f576)[0x7ff44228f576]
/home/dank/foo/lib/libMagickCore-7.Q16HDRI.so.1(RelinquishMagickMemory+0xf)[0x7ff442c1dccf]
/home/dank/foo/lib/libMagickWand-7.Q16HDRI.so.0(+0xf4dfc)[0x7ff4428e9dfc]
/home/dank/foo/lib/libMagickWand-7.Q16HDRI.so.0(CLIOption+0x281)[0x7ff4428eafe1]
/home/dank/foo/lib/libMagickWand-7.Q16HDRI.so.0(ProcessCommandOptions+0x32d)[0x7ff44288336d]

probably on exit. It does't matter what image you run it on; a much smaller image
is a better choice when valgrinding.

Valgrind says

==17773== Invalid free() / delete / delete[] / realloc()
==17773== at 0x4C2BA6C: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==17773== by 0x4F38CCE: RelinquishMagickMemory (memory.c:920)
==17773== by 0x53AEDFB: CLINoImageOperator (operation.c:4795)
==17773== by 0x53AFFE0: CLIOption (operation.c:4931)
==17773== by 0x534836C: ProcessCommandOptions (magick-cli.c:466)
==17773== by 0x5348C9C: MagickImageCommand (magick-cli.c:775)
==17773== by 0x5363F3D: MagickCommandGenesis (mogrify.c:173)
==17773== by 0x400886: main (magick.c:74)
==17773== Address 0x53c7b4a is not stack'd, malloc'd or (recently) free'd