From 5a6d8035d0c8c3cedb1899b6f5f7229f9a097f65 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 19 Oct 2019 14:29:07 +0300 Subject: [PATCH] - added access check for state functions Private functions cannot be called from derived classes anymore https://forum.zdoom.org/viewtopic.php?t=66158 --- src/scripting/zscript/zcc_compile.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index fa39d862be9..76c366d08d8 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -2998,6 +2998,11 @@ FxExpression *ZCCCompiler::SetupActionFunction(PClass *cls, ZCC_TreeNode *af, in int comboflags = afd->Variants[0].UseFlags & StateFlags; if (comboflags == StateFlags) // the function must satisfy all the flags the state requires { + if ((afd->Variants[0].Flags & VARF_Private) && afd->OwningClass != cls->VMType) + { + Error(af, "%s is declared private and not accessible", FName(id->Identifier).GetChars()); + } + return new FxVMFunctionCall(new FxSelf(*af), afd, argumentlist, *af, false); } else