mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-05 17:20:30 +00:00
DIRECTOR: Fix segfault when loading broken pic
Handle loadStream returning false when the pic doesn't confirm. In this case a 'DIB ' with a headersize not matching 40. Observed happening in: - Fujitsu fm TOWNS Super TECHNOLOGY DEMO - KUZIRA.MMM from PINGU
This commit is contained in:
parent
671603aa27
commit
1ec0dfb5e1
@ -721,13 +721,13 @@ void Cast::loadBitmapData(int key, BitmapCastMember *bitmapCast) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!img) {
|
||||
if (!img || !img->loadStream(*pic)) {
|
||||
warning("Cast::loadBitmapData():: Unable to load id: %d", imgId);
|
||||
delete pic;
|
||||
delete img;
|
||||
return;
|
||||
}
|
||||
|
||||
img->loadStream(*pic);
|
||||
|
||||
bitmapCast->_img = img;
|
||||
const Graphics::Surface *surf = img->getSurface();
|
||||
bitmapCast->_size = surf->pitch * surf->h + img->getPaletteColorCount() * 3;
|
||||
|
Loading…
Reference in New Issue
Block a user