Page 1 of 1

Adaptive image blur + specific channel = reading uninitialized memory.

Posted: 2015-02-18T10:39:58-07:00
by Danack
Hi,

I'm seeing a bug when calling `MagickAdaptiveBlurImageChannel(magickwand, 5, 1, BlueChannel);`

Source image
Image

Output Image
Image


Running the code through valgrind reports lots of reads from uninitialised memory. Running an equivalent command through convert shows similar errors in valgrind. The image generated through the command line varies, and does not appear to be always correct but is not as dramatically wrong.

Code: Select all

convert magick:logo test.png
valgrind convert test.png -channel B -adaptive-blur 5x1 output.png

==25458== Memcheck, a memory error detector
==25458== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==25458== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==25458== Command: convert test.png -channel B -adaptive-blur 5 1 output.png
==25458== 
==25458== Conditional jump or move depends on uninitialised value(s)
==25458==    at 0x4F8A0D8: MorphologyApply (morphology.c:3330)
==25458==    by 0x4F2959F: EdgeImage (effect.c:1305)
==25458==    by 0x4F2B516: AdaptiveBlurImageChannel (effect.c:212)
==25458==    by 0x557C17D: MogrifyImage (mogrify.c:739)
==25458==    by 0x55824CA: MogrifyImages (mogrify.c:8753)
==25458==    by 0x55053BF: ConvertImageCommand (convert.c:613)
==25458==    by 0x55A75DF: MagickCommandGenesis (mogrify.c:168)
==25458==    by 0x400984: main (in /usr/bin/convert)


Re: Adaptive image blur + specific channel = reading uninitialized memory.

Posted: 2015-02-19T11:07:39-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.9.0-7 Beta available by sometime tomorrow. Thanks.