overlaytopleft/games-fps/gzdoom/files/0029-Added-check-for-invalid-class-on-in-VM-instantiation.patch

26 lines
1.3 KiB
Diff

From 79f306ee58a7276d2bf81253540f36995bedb77a Mon Sep 17 00:00:00 2001
From: CandiceJoy <candice@candicejoy.com>
Date: Tue, 24 Jan 2023 14:23:04 -0600
Subject: [PATCH 29/51] Added check for invalid class on in-VM instantiation
Signed-off-by: CandiceJoy <candice@candicejoy.com>
---
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 f4d584c7b..a6c5a2370 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));
--
2.39.3