diff options
author | Travis Howell | 2005-02-27 00:42:52 +0000 |
---|---|---|
committer | Travis Howell | 2005-02-27 00:42:52 +0000 |
commit | cf0aac1506fbad0d71c9a50706def63127c16107 (patch) | |
tree | 94c3f78a2a5fb88bd71fdbb9345196fc5873346a | |
parent | 72efd4c50e95f55b757fdc50b9c36cbec7977f5d (diff) | |
download | scummvm-rg350-cf0aac1506fbad0d71c9a50706def63127c16107.tar.gz scummvm-rg350-cf0aac1506fbad0d71c9a50706def63127c16107.tar.bz2 scummvm-rg350-cf0aac1506fbad0d71c9a50706def63127c16107.zip |
Add more safety checks.
svn-id: r16939
-rw-r--r-- | scumm/script_v72he.cpp | 4 | ||||
-rw-r--r-- | scumm/wiz_he.cpp | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 7a686e6028..ab11381e31 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -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); diff --git a/scumm/wiz_he.cpp b/scumm/wiz_he.cpp index a7b6f75e7f..952714ff0c 100644 --- a/scumm/wiz_he.cpp +++ b/scumm/wiz_he.cpp @@ -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); } } |