Re: [AD] Possible bug in 4.2 bitmap loading code. |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2008-03-23, David Capello <davidcapello@xxxxxxxxxx> wrote:
> Done. I attached the patch.
>
> To test the RGB and Bitfields BMPs with positive and
> negative height, here you have a little test:
>
> http://www.dacap.com.ar/bmpbug.zip
> Index: bmp.c
> ===================================================================
> --- bmp.c (revision 10104)
> +++ bmp.c (working copy)
> @@ -302,16 +302,21 @@
> */
> static void read_bitfields_image(PACKFILE *f, BITMAP *bmp, AL_CONST BITMAPINFOHEADER *infoheader)
> {
> - int k, i;
> + int k, i, line, height, dir;
> int bpp;
> int bytes_per_pixel;
> int red, grn, blu;
> unsigned long buffer;
>
> + height = (int)infoheader->biHeight;
I am not sure why biHeight is left as an `unsigned long'. Shouldn't it just be
changed to `signed long' and then we can get rid of the int casts?
Otherwise the patch looks okay.
A glance at the bmp.c code shows that it's very trusting of the source file.
Anybody feel like fixing it? (or any of the other loaders)
Peter