Page 1 of 1

[SOLVED] .mpc segfaults on 7.0.0 w/ convert -distort resize

Posted: 2012-03-11T21:18:36-07:00
by NicolasRobidoux
When I try to use a .mpc version of an image, convert segfaults:

Code: Select all

convert big.jpg big.mpc
convert big.mpc -filter Robidoux -distort resize 100x100^ -gravity center -extent 100x100 -quality 75 -sampling-factor 2x2 tiny.jpg
Direct convert is fine:

Code: Select all

convert big.jpg -filter Robidoux -distort resize 100x100^ -gravity center -extent 100x100 -quality 75 -sampling-factor 2x2 tiny.jpg
ImageMagick 7.0.0-0 2012-03-11 Q16 compiled from source from svn on Linux Mint 12 with

Code: Select all

./configure CFLAGS="-fopenmp -fomit-frame-pointer -O2 -Wall -march=native -pthread" CXXFLAGS="-O2 -pthread"
8GiB RAM and lots of disk space available.

This happens even with small images (.cache = 59K).

(I'll poke around some more tomorrow.)

Re: .mpc image segfaults

Posted: 2012-03-11T21:46:36-07:00
by NicolasRobidoux
Plain ./configure compilation does not change anything.

Re: .mpc image segfaults

Posted: 2012-03-11T22:32:44-07:00
by NicolasRobidoux
./configure --with-quantum-depth=8 makes no difference.

Re: .mpc image segfaults

Posted: 2012-03-11T22:36:39-07:00
by NicolasRobidoux
ImageMagick 6.6.0-4 2011-06-15 Q16 from the package manager has no problem.

P.S. ... but no convert -distort resize.

Re: .mpc image segfaults on 7.0.0 when convert -distort res

Posted: 2012-03-13T05:51:31-07:00
by NicolasRobidoux
I've narrowed down the problem: It's specifically with convert -distort resize.

convert -resize works fine.

Now, there is something else I've seen sometime in the last few weeks, but did not take note of the exact operation that did it at the time, but it would appear to me to be possibly related:

convert -distort resize and convert -resize do not always produce images with the same pixel dimensions when fed the same instruction. convert -distort resize, if I remember, sometimes produces an image which is one pixel smaller in one of the two directions (or is it the other way around?). What the above seg fault with -distort resize combined with this suggests to me is that the memory region/pixels accessed by -distort resize is not quite right, which sometimes results in an out of memory read, made more obvious by the use of .mpc.

(Of course, this is a conjecture.)

And of course, I may be the one who messed things up to start with in the source code. Although I kind of doubt it: I've not heard of the same code crashing within GEGL (where I ported it from IM). And convert -filter Robidoux -distort Resize has downsized hundreds of thousands of images to various dimensions with various flags (>, ^, none) at a commercial client of mine running IM 6.6.9-9 since August 2011, apparently without a glitch (and his thousands of clients check on the resulting images, although apparently they are pretty forgiving).

P.S. Unfortunately, I'm swamped these days so I don't have time to dig into the source code to see if I can figure what the problem is.

Re: .mpc image segfaults on 7.0.0 when convert -distort res

Posted: 2012-03-13T06:27:57-07:00
by NicolasRobidoux
Busy for a few hours, but I'll make sure that it's not the package-managed IM somehow interfering with the compiled from source one. I did not do a prefixed install. (But I did svn up this morning.)

Re: .mpc image segfaults on 7.0.0 when convert -distort res

Posted: 2012-03-13T06:30:09-07:00
by magick
We can reproduce the problem you reported and have a patch. Look for it by sometime tomorrow in ImageMagick 7.0.0-0 Alpha. Thanks.

Re: .mpc image segfaults on 7.0.0 when convert -distort res

Posted: 2012-03-13T08:51:24-07:00
by NicolasRobidoux
(Apologies: I typed here something I wanted to email someone unrelated to ImageMagick. Funny enough, it had to do with "we all understand making mistakes". In the wrong context, however, it could seem quite patronizing.)

Re: [SOLVED].mpc segfaults on 7.0.0 w./ convert -distort res

Posted: 2012-03-14T10:52:31-07:00
by NicolasRobidoux
No more seg fault :-)