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:
Roland van Laar 2022-10-18 09:27:01 +02:00
parent 671603aa27
commit 1ec0dfb5e1

View File

@ -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;