diff options
author | Colin Snover | 2017-02-25 19:16:26 -0600 |
---|---|---|
committer | Colin Snover | 2017-04-22 19:38:13 -0500 |
commit | 9e7c75cc79c7b39b1dcdb9d48bd2ed0c33c649f0 (patch) | |
tree | 0a20fb210c79b4e38fb0d79762f202e6ef29e72f | |
parent | 78fd8d39c500cb85fdf5766ce1d836816264fad6 (diff) | |
download | scummvm-rg350-9e7c75cc79c7b39b1dcdb9d48bd2ed0c33c649f0.tar.gz scummvm-rg350-9e7c75cc79c7b39b1dcdb9d48bd2ed0c33c649f0.tar.bz2 scummvm-rg350-9e7c75cc79c7b39b1dcdb9d48bd2ed0c33c649f0.zip |
SCI: Avoid crashing when disassembling a call with a bad object
lookupSelector will raise an error if the passed object ID is
invalid.
-rw-r--r-- | engines/sci/engine/scriptdebug.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index 2dcf03b0d8..507fd97795 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -317,18 +317,22 @@ reg_t disassemble(EngineState *s, reg32_t pos, reg_t objAddr, bool printBWTag, b debugN(" %s::%s[", name, g_sci->getKernel()->getSelectorName(selector).c_str()); - switch (lookupSelector(s->_segMan, called_obj_addr, selector, 0, &fun_ref)) { - case kSelectorMethod: - debugN("FUNCT"); - argc += restmod; - restmod = 0; - break; - case kSelectorVariable: - debugN("VAR"); - break; - case kSelectorNone: - debugN("INVALID"); - break; + if (!s->_segMan->getObject(called_obj_addr)) { + debugN("INVALID_OBJ"); + } else { + switch (lookupSelector(s->_segMan, called_obj_addr, selector, 0, &fun_ref)) { + case kSelectorMethod: + debugN("FUNCT"); + argc += restmod; + restmod = 0; + break; + case kSelectorVariable: + debugN("VAR"); + break; + case kSelectorNone: + debugN("INVALID"); + break; + } } debugN("]("); |