diff options
author | Torbjörn Andersson | 2013-05-01 07:33:05 +0200 |
---|---|---|
committer | Torbjörn Andersson | 2013-05-01 07:33:05 +0200 |
commit | f70087dc90255166e9cd8cf38b80d34a3a4e6494 (patch) | |
tree | c284163676964897fa8e8cd1493ea94ec7f802b9 /engines | |
parent | f3f3d5bcbf949cff514e58dc1f2b0c1d4e743cab (diff) | |
download | scummvm-rg350-f70087dc90255166e9cd8cf38b80d34a3a4e6494.tar.gz scummvm-rg350-f70087dc90255166e9cd8cf38b80d34a3a4e6494.tar.bz2 scummvm-rg350-f70087dc90255166e9cd8cf38b80d34a3a4e6494.zip |
SCUMM: Fix out-of-bounds access in runScript() debug messages
I believe this fixes CID 1003954, 1003957, 1003958, 1003962 and
1003966.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/script.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index d025ede47b..96c55146fd 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -49,6 +49,8 @@ void ScummEngine::runScript(int script, bool freezeResistant, bool recursive, in if (!recursive) stopScript(script); + uint16 number = (_currentScript != 0xFF) ? vm.slot[_currentScript].number : 0; + if (script < _numGlobalScripts) { // Call getResourceAddress to ensure the resource is loaded & its usage count reset /*scriptPtr =*/ getResourceAddress(rtScript, script); @@ -56,7 +58,7 @@ void ScummEngine::runScript(int script, bool freezeResistant, bool recursive, in scriptType = WIO_GLOBAL; debugC(DEBUG_SCRIPTS, "runScript(Global-%d) from %d-%d", script, - vm.slot[_currentScript].number, _roomResource); + number, _roomResource); } else { scriptOffs = _localScriptOffsets[script - _numGlobalScripts]; if (scriptOffs == 0) @@ -64,7 +66,7 @@ void ScummEngine::runScript(int script, bool freezeResistant, bool recursive, in scriptType = WIO_LOCAL; debugC(DEBUG_SCRIPTS, "runScript(%d) from %d-%d", script, - vm.slot[_currentScript].number, _roomResource); + number, _roomResource); } if (cycle == 0) |