Catch all invalid image resource reads
svn-id: r16924
This commit is contained in:
parent
6d7935cc6b
commit
1d23aada61
2 changed files with 10 additions and 9 deletions
|
@ -314,7 +314,12 @@ int ScummEngine_v90he::spriteInfoGet_field_88(int spriteId, int type) {
|
|||
void ScummEngine_v90he::getSpriteImageDim(int spriteId, int32 &w, int32 &h) {
|
||||
checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d");
|
||||
|
||||
getWizImageDim(_spriteTable[spriteId].res_id, _spriteTable[spriteId].res_state, w, h);
|
||||
if (_spriteTable[spriteId].res_id) {
|
||||
getWizImageDim(_spriteTable[spriteId].res_id, _spriteTable[spriteId].res_state, w, h);
|
||||
} else {
|
||||
w = 0;
|
||||
h = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ScummEngine_v90he::spriteInfoGet_tx_ty(int spriteId, int32 &tx, int32 &ty) {
|
||||
|
|
|
@ -843,14 +843,10 @@ void ScummEngine_v72he::displayWizImage(const WizImage *pwi) {
|
|||
|
||||
void ScummEngine_v72he::getWizImageDim(int resnum, int state, int32 &w, int32 &h) {
|
||||
const uint8 *dataPtr = getResourceAddress(rtImage, resnum);
|
||||
if (dataPtr) {
|
||||
const uint8 *wizh = findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
|
||||
w = READ_LE_UINT32(wizh + 0x4);
|
||||
h = READ_LE_UINT32(wizh + 0x8);
|
||||
} else {
|
||||
w = 0;
|
||||
h = 0;
|
||||
}
|
||||
assert(dataPtr);
|
||||
const uint8 *wizh = findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
|
||||
w = READ_LE_UINT32(wizh + 0x4);
|
||||
h = READ_LE_UINT32(wizh + 0x8);
|
||||
}
|
||||
|
||||
uint8 *ScummEngine_v72he::drawWizImage(int restype, const WizImage *pwi) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue