From f73584f0e5b43f24db4b66cdd07acc7f5c9f617b Mon Sep 17 00:00:00 2001 From: sluicebox Date: Sun, 17 Mar 2019 16:21:57 -0700 Subject: 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. --- engines/sci/engine/scriptdebug.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'engines/sci/engine') 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 = ""; + } } else { selectorName = ""; } -- cgit v1.2.3