SCUMM: Fixed reading malformed resources. Bug #11463

This commit is contained in:
Eugene Sandulenko 2020-05-05 14:04:36 +02:00
parent 20ebd47f49
commit 1a6ffd6398

View File

@ -653,8 +653,14 @@ int ScummEngine::loadResource(ResType type, ResId idx) {
if ((_game.version == 3) && !(_game.platform == Common::kPlatformAmiga) && (type == rtSound)) {
return readSoundResourceSmallHeader(idx);
} else {
size = _fileHandle->readUint16LE();
_fileHandle->seek(-2, SEEK_CUR);
// WORKAROUND: Apple //gs MM has malformed sound resource #68
if (_fileHandle->pos() + 2 > _fileHandle->size()) {
warning("loadResource(%s,%d): resource is too short", nameOfResType(type), idx);
size = 0;
} else {
size = _fileHandle->readUint16LE();
_fileHandle->seek(-2, SEEK_CUR);
}
}
} else if (_game.features & GF_SMALL_HEADER) {
if (_game.version == 4)