diff options
author | Paul Gilbert | 2019-06-15 15:47:32 -0700 |
---|---|---|
committer | Paul Gilbert | 2019-06-15 22:31:50 -0700 |
commit | 1b6ac1a67cc65ca5fcb5c076f3f48b7ce8c6e6a8 (patch) | |
tree | 48f7882bb9fc0978a54f140842d1c391596e74f5 /engines/glk | |
parent | b6542b78fcb2270ab29839f16c2eb5ac1d904c7e (diff) | |
download | scummvm-rg350-1b6ac1a67cc65ca5fcb5c076f3f48b7ce8c6e6a8.tar.gz scummvm-rg350-1b6ac1a67cc65ca5fcb5c076f3f48b7ce8c6e6a8.tar.bz2 scummvm-rg350-1b6ac1a67cc65ca5fcb5c076f3f48b7ce8c6e6a8.zip |
GLK: ADVSYS: Fix variable range checks
Diffstat (limited to 'engines/glk')
-rw-r--r-- | engines/glk/advsys/game.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/glk/advsys/game.cpp b/engines/glk/advsys/game.cpp index 3b6133d6ef..d051a352b6 100644 --- a/engines/glk/advsys/game.cpp +++ b/engines/glk/advsys/game.cpp @@ -250,12 +250,16 @@ int Game::getActionLocation(int action) const { } int Game::getVariable(int variableNum) { - assert(variableNum < _variableCount); + if (variableNum < 1 || variableNum > _variableCount) + error("Invalid ariable number %d", variableNum); + return READ_LE_UINT16(_variableTable + variableNum * 2); } void Game::setVariable(int variableNum, int value) { - assert(variableNum < _variableCount); + if (variableNum < 1 || variableNum > _variableCount) + error("Invalid ariable number %d", variableNum); + WRITE_LE_UINT16(_variableTable + variableNum * 2, value); } |