diff options
author | Johannes Schickel | 2008-04-19 13:58:32 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-04-19 13:58:32 +0000 |
commit | a79c91b7d0dbe856728e218b6de496cfae040afd (patch) | |
tree | 77cd91253202441b1c94dd88f4f517a2caf12da4 | |
parent | bf46b5f17868cee22aea71b274a3515593206fbd (diff) | |
download | scummvm-rg350-a79c91b7d0dbe856728e218b6de496cfae040afd.tar.gz scummvm-rg350-a79c91b7d0dbe856728e218b6de496cfae040afd.tar.bz2 scummvm-rg350-a79c91b7d0dbe856728e218b6de496cfae040afd.zip |
Added some asserts to prevent out of bounds access.
svn-id: r31570
-rw-r--r-- | engines/kyra/script_tim.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/script_tim.h | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp index 4454dec539..8d079bdb0d 100644 --- a/engines/kyra/script_tim.cpp +++ b/engines/kyra/script_tim.cpp @@ -35,7 +35,7 @@ TIMInterpreter::TIMInterpreter(KyraEngine *vm, OSystem *system) : _vm(vm), _syst #define COMMAND_UNIMPL() { 0, 0 } static CommandEntry commandProcs[] = { // 0x00 - COMMAND(cmd_restartFunc0), + COMMAND(cmd_startFunc0Now), COMMAND(cmd_stopCurFunc), COMMAND_UNIMPL(), COMMAND_UNIMPL(), @@ -199,7 +199,7 @@ int TIMInterpreter::execCommand(int cmd, const uint16 *param) { return (this->*_commands[cmd].proc)(param); } -int TIMInterpreter::cmd_restartFunc0(const uint16 *param) { +int TIMInterpreter::cmd_startFunc0Now(const uint16 *param) { _currentTim->func[0].ip = _currentTim->func[0].avtl; _currentTim->func[0].lastTime = _system->getMillis(); return 1; @@ -215,6 +215,7 @@ int TIMInterpreter::cmd_stopCurFunc(const uint16 *param) { int TIMInterpreter::cmd_initFunc(const uint16 *param) { uint16 func = *param; + assert(func < 10); if (_currentTim->func[func].avtl) _currentTim->func[func].ip = _currentTim->func[func].avtl; else @@ -224,6 +225,7 @@ int TIMInterpreter::cmd_initFunc(const uint16 *param) { int TIMInterpreter::cmd_stopFunc(const uint16 *param) { uint16 func = *param; + assert(func < 10); _currentTim->func[func].ip = 0; return 1; } @@ -253,6 +255,7 @@ int TIMInterpreter::cmd_execOpcode(const uint16 *param) { int TIMInterpreter::cmd_initFuncNow(const uint16 *param) { uint16 func = *param; + assert(func < 10); _currentTim->func[func].ip = _currentTim->func[func].avtl; _currentTim->func[func].lastTime = _currentTim->func[func].nextTime = _system->getMillis(); return 1; @@ -260,6 +263,7 @@ int TIMInterpreter::cmd_initFuncNow(const uint16 *param) { int TIMInterpreter::cmd_stopFuncNow(const uint16 *param) { uint16 func = *param; + assert(func < 10); _currentTim->func[func].ip = 0; _currentTim->func[func].lastTime = _currentTim->func[func].nextTime = _system->getMillis(); return 1; diff --git a/engines/kyra/script_tim.h b/engines/kyra/script_tim.h index da5ba74831..4d19c51ded 100644 --- a/engines/kyra/script_tim.h +++ b/engines/kyra/script_tim.h @@ -86,7 +86,7 @@ private: const CommandEntry *_commands; int _commandsSize; - int cmd_restartFunc0(const uint16 *param); + int cmd_startFunc0Now(const uint16 *param); int cmd_stopCurFunc(const uint16 *param); int cmd_initFunc(const uint16 *param); int cmd_stopFunc(const uint16 *param); |