Add more safety checks.

svn-id: r16939
This commit is contained in:
Travis Howell 2005-02-27 00:42:52 +00:00
parent 72efd4c50e
commit cf0aac1506
2 changed files with 5 additions and 4 deletions

View File

@ -598,8 +598,8 @@ const byte *ScummEngine_v72he::findWrappedBlock(uint32 tag, const byte *ptr, int
return NULL;
size = getResourceDataSize(offs) / 4;
if ((uint32)state >= (uint32)size)
return NULL;
assert((uint32)state <= (uint32)size);
offs += READ_LE_UINT32(offs + state * sizeof(uint32));
offs = findResourceData(tag, offs - 8);

View File

@ -845,6 +845,7 @@ void ScummEngine_v72he::getWizImageDim(int resnum, int state, int32 &w, int32 &h
const uint8 *dataPtr = getResourceAddress(rtImage, resnum);
assert(dataPtr);
const uint8 *wizh = findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
assert(wizh);
w = READ_LE_UINT32(wizh + 0x4);
h = READ_LE_UINT32(wizh + 0x8);
}
@ -1311,10 +1312,10 @@ void ScummEngine_v90he::processWizImage(const WizParameters *params) {
case 10:
case 11:
case 12:
warning("unhandled processWizImage mode %d", params->processMode);
warning("Unhandled processWizImage mode %d", params->processMode);
break;
default:
warning("invalid processWizImage mode %d", params->processMode);
debug(1, "Invalid processWizImage mode %d", params->processMode);
}
}