From c0945a116a60e7248bc3356a13b2fa0b49d42db1 Mon Sep 17 00:00:00 2001 From: CandiceJoy Date: Thu, 26 Jan 2023 07:39:58 -0600 Subject: [PATCH 30/51] Fixed a bug where calling an invalid virtual function would cause a crash. --- src/common/scripting/vm/vmexec.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/scripting/vm/vmexec.h b/src/common/scripting/vm/vmexec.h index 6716509da..f303304b8 100644 --- a/src/common/scripting/vm/vmexec.h +++ b/src/common/scripting/vm/vmexec.h @@ -849,6 +849,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret) return 0; } auto p = o->GetClass(); + if(p->Virtuals.Size() <= 0) ThrowAbortException(X_OTHER,"Attempted to call an invalid virtual function in class %s",p->TypeName.GetChars()); assert(C < p->Virtuals.Size()); reg.a[a] = p->Virtuals[C]; } -- 2.39.3