diff options
author | Strangerke | 2013-10-24 07:56:32 +0200 |
---|---|---|
committer | Strangerke | 2013-10-24 07:56:32 +0200 |
commit | 0b4baa6873ae9a8249b8ce63a19fe0ed0d99f7b0 (patch) | |
tree | d19b88510d6dac7229204eea4eca5937e7e7c686 | |
parent | b64e62188359675c7d6b727bea1da814660723eb (diff) | |
download | scummvm-rg350-0b4baa6873ae9a8249b8ce63a19fe0ed0d99f7b0.tar.gz scummvm-rg350-0b4baa6873ae9a8249b8ce63a19fe0ed0d99f7b0.tar.bz2 scummvm-rg350-0b4baa6873ae9a8249b8ce63a19fe0ed0d99f7b0.zip |
AVALANCHE: Fix a couple of (theoretical) out of bounds accesses (CID 1109650)
-rw-r--r-- | engines/avalanche/avalot.cpp | 2 | ||||
-rw-r--r-- | engines/avalanche/parser.cpp | 15 | ||||
-rw-r--r-- | engines/avalanche/parser.h | 2 |
3 files changed, 12 insertions, 7 deletions
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index a7108841d4..072ad00ed6 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1229,7 +1229,7 @@ void AvalancheEngine::checkClick() { _parser->_thing += 49; _parser->_person = kPeoplePardon; } else { - _parser->_person = (People) _thinks; + _parser->_person = (People)_thinks; _parser->_thing = _parser->kPardon; } callVerb(kVerbCodeExam); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 4cc184bfd9..297f27ffb8 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1015,10 +1015,13 @@ bool Parser::isHolding() { if (_thing > 100) _vm->_dialogs->displayText("Be reasonable!"); - else if (!_vm->_objects[_thing - 1]) - // Verbs that need "_thing" to be in the inventory. - _vm->_dialogs->displayText("You're not holding it, Avvy."); - else + else if (_thing <= kObjectNum) { + if (!_vm->_objects[_thing - 1]) + // Verbs that need "_thing" to be in the inventory. + _vm->_dialogs->displayText("You're not holding it, Avvy."); + else + holdingResult = true; + } else holdingResult = true; return holdingResult; @@ -1053,8 +1056,10 @@ void Parser::examine() { examineObject(); else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing + int id = _thing - 50; + assert(id < 31); openBox(true); - _vm->_dialogs->displayText(*_vm->_also[_thing - 50][1]); + _vm->_dialogs->displayText(*_vm->_also[id][1]); openBox(false); } } diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 261e5ecefe..bdb5ab9bc1 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -66,7 +66,7 @@ public: Common::String _inputText; // Original name: current Common::String _inputTextBackup; byte _inputTextPos; // Original name: curpos - bool _quote; // 66 or 99 next? + bool _quote; bool _cursorState; bool _weirdWord; |