Distort after scale uses uninitialized values

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

Distort after scale uses uninitialized values

Post by Danack »

The code below which does a MagickDistortImage after doing MagickScaleImage gives lots of valgrind "using uninitialized memory" warning.

Code: Select all

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <wand/MagickWand.h>


int main(int argc,char **argv) {
    MagickWand *magick_wand;
    MagickWandGenesis();
    
    magick_wand = NewMagickWand();

    MagickReadImage(magick_wand, "magick:logo");
    double arguments[] = {
        0.5, 0, 0,
        1, 100, 0
    };
    MagickScaleImage(magick_wand, 400, 300);
    MagickDistortImage(
        magick_wand, 
        AffineProjectionDistortion, 
        6,
        arguments,
        0
    );

    MagickWriteImage(magick_wand, "./edge_output.png");
    MagickWandTerminus();

    return 0;
}

Output
==11779== Conditional jump or move depends on uninitialised value(s)
==11779== at 0x542A1B1: ClampToQuantum (in /usr/lib64/libMagickCore-6.Q16.so.2.0.0)
==11779== by 0x542BB16: ResamplePixelColor (in /usr/lib64/libMagickCore-6.Q16.so.2.0.0)
==11779== by 0x5354724: DistortImage (in /usr/lib64/libMagickCore-6.Q16.so.2.0.0)
==11779== by 0x4F60FA7: MagickDistortImage (in /usr/lib64/libMagickWand-6.Q16.so.2.0.0)
==11779== by 0x400885: main (edgeMemory.c:22)
==11779== ...
==11779== ERROR SUMMARY: 240600 errors from 4 contexts (suppressed: 6 from 6)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Distort after scale uses uninitialized values

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.9.0-8 Beta, available by sometime tomorrow. Thanks.
Post Reply