Bug? ImageMagick 6.3.4.9 vs a large BMP

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
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Bug? ImageMagick 6.3.4.9 vs a large BMP

Post by el_supremo »

The bmp.c coder is reading the image's width and height as long integers but then casting them as (short) which will truncate 70000 to 4464.
In bmp.c at line 639, this code:

Code: Select all

        /*
          Microsoft Windows BMP image file.
        */
        if (bmp_info.size < 40)
          ThrowReaderException(CorruptImageError,"NonOS2HeaderSizeError");
        bmp_info.width=(short) ReadBlobLSBLong(image);
        bmp_info.height=(short) ReadBlobLSBLong(image);
should be changed to this:

Code: Select all

        /*
          Microsoft Windows BMP image file.
        */
        if (bmp_info.size < 40)
          ThrowReaderException(CorruptImageError,"NonOS2HeaderSizeError");
        bmp_info.width= ReadBlobLSBLong(image);
        bmp_info.height= ReadBlobLSBLong(image);
I can't test it right now but that should fix it.
Pete
Post Reply