diff options
Diffstat (limited to 'engines/sci/engine/kernel.cpp')
-rw-r--r-- | engines/sci/engine/kernel.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 8fb6322f55..a83a026762 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -488,8 +488,15 @@ bool Kernel::signatureMatch(const uint16 *sig, int argc, const reg_t *argv) { if ((type & SIG_IS_INVALID) && (!(curSig & SIG_IS_INVALID))) return false; // pointer is invalid and signature doesn't allow that? - if (!((type & ~SIG_IS_INVALID) & curSig)) - return false; // type mismatch + if (!((type & ~SIG_IS_INVALID) & curSig)) { + if ((type & ~SIG_IS_INVALID) == SIG_TYPE_ERROR && (curSig & SIG_IS_INVALID)) { + // Type is unknown (error - usually because of a deallocated object or + // stale pointer) and the signature allows invalid pointers. In this case, + // ignore the invalid pointer. + } else { + return false; // type mismatch + } + } if (!(curSig & SIG_MORE_MAY_FOLLOW)) { sig++; |