Skip to content

Commit

Permalink
- added access check for state functions
Browse files Browse the repository at this point in the history
Private functions cannot be called from derived classes anymore

https://forum.zdoom.org/viewtopic.php?t=66158
  • Loading branch information
alexey-lysiuk authored and coelckers committed Oct 19, 2019
1 parent 1deade9 commit 5a6d803
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/scripting/zscript/zcc_compile.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 5a6d803

Please sign in to comment.