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) {
|
void ScummEngine_v90he::getSpriteImageDim(int spriteId, int32 &w, int32 &h) {
|
||||||
checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d");
|
checkRange(_varNumSprites, 1, spriteId, "Invalid sprite %d");
|
||||||
|
|
||||||
|
if (_spriteTable[spriteId].res_id) {
|
||||||
getWizImageDim(_spriteTable[spriteId].res_id, _spriteTable[spriteId].res_state, w, h);
|
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) {
|
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) {
|
void ScummEngine_v72he::getWizImageDim(int resnum, int state, int32 &w, int32 &h) {
|
||||||
const uint8 *dataPtr = getResourceAddress(rtImage, resnum);
|
const uint8 *dataPtr = getResourceAddress(rtImage, resnum);
|
||||||
if (dataPtr) {
|
assert(dataPtr);
|
||||||
const uint8 *wizh = findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
|
const uint8 *wizh = findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
|
||||||
w = READ_LE_UINT32(wizh + 0x4);
|
w = READ_LE_UINT32(wizh + 0x4);
|
||||||
h = READ_LE_UINT32(wizh + 0x8);
|
h = READ_LE_UINT32(wizh + 0x8);
|
||||||
} else {
|
|
||||||
w = 0;
|
|
||||||
h = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 *ScummEngine_v72he::drawWizImage(int restype, const WizImage *pwi) {
|
uint8 *ScummEngine_v72he::drawWizImage(int restype, const WizImage *pwi) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue