aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorsluicebox2019-03-17 16:21:57 -0700
committerFilippos Karapetis2019-03-18 07:44:23 +0200
commitf73584f0e5b43f24db4b66cdd07acc7f5c9f617b (patch)
tree98f9c0623bab585b9dc2185cb74fcad9a12ded4f /engines/sci/engine
parentcea00af6739553b3348c545912b4bfec16978057 (diff)
downloadscummvm-rg350-f73584f0e5b43f24db4b66cdd07acc7f5c9f617b.tar.gz
scummvm-rg350-f73584f0e5b43f24db4b66cdd07acc7f5c9f617b.tar.bz2
scummvm-rg350-f73584f0e5b43f24db4b66cdd07acc7f5c9f617b.zip
SCI: Fix disassembler crash on invalid property
Fixes debugger crash when disassembling an instruction whose operand is an invalid property. This occurs in LB2 floppy 1.0 script 720 in sGetUp:changeState and sStepOnNail:changeState.
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/scriptdebug.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index f5c1f8de8f..2bb58d4ff2 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -218,7 +218,11 @@ reg_t disassemble(EngineState *s, reg_t pos, const Object *obj, bool printBWTag,
if (obj != nullptr) {
const Object *const super = obj->getClass(s->_segMan);
assert(super);
- selectorName = kernel->getSelectorName(super->getVarSelector(param_value / 2)).c_str();
+ if (param_value / 2 < super->getVarCount()) {
+ selectorName = kernel->getSelectorName(super->getVarSelector(param_value / 2)).c_str();
+ } else {
+ selectorName = "<invalid>";
+ }
} else {
selectorName = "<unavailable>";
}