Page 1 of 1

Floating-point exception in QueryMagickColor

Posted: 2008-08-21T16:09:07-07:00
by rmagick
The bogus color "#OOOOOO" (capital oh, not zero) causes a floating-point exception in QueryMagickColor. Of course it's easy to fix my code but I thought you'd want to know about it.

Here's the reproduction:

Code: Select all

/*
gcc `Magick-config --cflags --cppflags` 000000.c `Magick-config --ldflags --libs` -o 000000
*/


#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include "magick/MagickCore.h"


int main(int argc,char **argv)
{
    const char *version;
    MagickPixelPacket color;
    ExceptionInfo exception;

    MagickCoreGenesis("000000", MagickFalse);

    version = GetMagickVersion(NULL);
    fputs(version, stderr); fputc('\n', stderr);

    GetExceptionInfo(&exception);
    GetMagickPixelPacket(NULL, &color);
    (void) QueryMagickColor("#OOOOOO", &color, &exception);

    DestroyExceptionInfo(&exception);

    MagickCoreTerminus();

    exit(0);
}


Re: Floating-point exception in QueryMagickColor

Posted: 2008-08-21T16:44:13-07:00
by magick
The problem you reported is fixed in the subversion trunk. Look for it also in the next point release.