Adaptive image blur + specific channel = reading uninitialized memory.

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Danack
Posts: 73
Joined: 2013-10-14T10:00:25-07:00
Authentication code: 6789

Adaptive image blur + specific channel = reading uninitialized memory.

Post 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)

User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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.
Post Reply