From: <tj...@us...> - 2006-07-30 14:23:17
|
Revision: 7427 Author: tjaden Date: 2006-07-30 07:23:08 -0700 (Sun, 30 Jul 2006) ViewCVS: http://svn.sourceforge.net/alleg/?rev=7427&view=rev Log Message: ----------- Peter Wang fixed a bug where trying to load an invalid compressed BMP could cause a null pointer dereference. Also added an ASSERT to _fixup_loaded_bitmap. Modified Paths: -------------- allegro/branches/4.3/src/bmp.c allegro/branches/4.3/src/readbmp.c Modified: allegro/branches/4.3/src/bmp.c =================================================================== --- allegro/branches/4.3/src/bmp.c 2006-07-30 12:43:03 UTC (rev 7426) +++ allegro/branches/4.3/src/bmp.c 2006-07-30 14:23:08 UTC (rev 7427) @@ -679,7 +679,9 @@ if ((bpp != 8) && (!want_palette)) pal = NULL; - bmp = _fixup_loaded_bitmap(bmp, pal, dest_depth); + if (bmp) { + bmp = _fixup_loaded_bitmap(bmp, pal, dest_depth); + } } /* construct a fake palette if 8-bit mode is not involved */ Modified: allegro/branches/4.3/src/readbmp.c =================================================================== --- allegro/branches/4.3/src/readbmp.c 2006-07-30 12:43:03 UTC (rev 7426) +++ allegro/branches/4.3/src/readbmp.c 2006-07-30 14:23:08 UTC (rev 7427) @@ -125,6 +125,7 @@ BITMAP *_fixup_loaded_bitmap(BITMAP *bmp, PALETTE pal, int bpp) { BITMAP *b2; + ASSERT(bmp); b2 = create_bitmap_ex(bpp, bmp->w, bmp->h); if (!b2) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |