From 1e39202484c18c6d95a9f68d6c880b725a66e565 Mon Sep 17 00:00:00 2001 From: CandiceJoy Date: Tue, 24 Jan 2023 14:23:04 -0600 Subject: [PATCH] Added check for invalid class on in-VM instantiation Signed-off-by: CandiceJoy --- src/common/scripting/core/scopebarrier.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/scripting/core/scopebarrier.cpp b/src/common/scripting/core/scopebarrier.cpp index f4d584c7ba..a6c5a23705 100644 --- a/src/common/scripting/core/scopebarrier.cpp +++ b/src/common/scripting/core/scopebarrier.cpp @@ -211,6 +211,7 @@ void FScopeBarrier::AddFlags(int flags1, int flags2, const char* name) // these are for vmexec.h void FScopeBarrier::ValidateNew(PClass* cls, int outerside) { + if (cls->VMType == nullptr) ThrowAbortException(X_OTHER,"Cannot instantiate invalid class %s", cls->TypeName.GetChars()); int innerside = FScopeBarrier::SideFromObjectFlags(cls->VMType->ScopeFlags); if ((outerside != innerside) && (innerside != FScopeBarrier::Side_PlainData)) // "cannot construct ui class ... from data context" ThrowAbortException(X_OTHER, "Cannot construct %s class %s from %s context", FScopeBarrier::StringFromSide(innerside), cls->TypeName.GetChars(), FScopeBarrier::StringFromSide(outerside));