Is it required to call MagickFilterImage only with square, odd-sized filters (e.g. 3x3) or would non-square values be allowed? e.g. 3x4
The function seems to give an error if even sized filters are used (e.g. 4x4) but doesn't give an error for 3x4 size. However the image generated is highly corrupted, with valgrind reporting a large number of errors.
Asking in this forum, as if it's not allowed, then I think it should be checked for, just like the check against even sizes, to prevent image corruption.
==5112== Conditional jump or move depends on uninitialised value(s)
==5112== at 0x12D3843B: FilterImageChannel (quantum.h:94)
==5112== by 0x129C419B: MagickFilterImageChannel (magick-image.c:3400)
==5112== by 0x126DBB45: zim_imagick_filter (imagick_class.c:11556)
MagickFilterImage and non-square filters?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: MagickFilterImage and non-square filters?
magick-image.c function MagickFilterImage calls effect.c function FilterImage, which contains:
There seems to be no restriction on kernel height. There is code in there that is activated by debug, so you might try that.
Code: Select all
if ((kernel->width % 2) == 0)
ThrowImageException(OptionError,"KernelWidthMustBeAnOddNumber");
Agreed. A developer would need to comment.Danack wrote:... if it's not allowed, then I think it should be checked for, just like the check against even sizes, to prevent image corruption.
snibgo's IM pages: im.snibgo.com
Re: MagickFilterImage and non-square filters?
We can reproduce the problem you posted and have a patch in ImageMagick 6.9.0-6 Beta, available by sometime tomorrow. Thanks.