From 53ff7f0c73ea46193d029c58897ed3a1a8191999 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 25 Nov 2016 16:35:07 +0100 Subject: [PATCH] - fixed: Do not allow empty function arguments pass. For unknown reasons the grammar accepts them as valid, so this needs to be checked when resolving them. --- src/scripting/codegeneration/codegen.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/scripting/codegeneration/codegen.cpp b/src/scripting/codegeneration/codegen.cpp index 908850e3e..ab0bb96e1 100644 --- a/src/scripting/codegeneration/codegen.cpp +++ b/src/scripting/codegeneration/codegen.cpp @@ -6820,6 +6820,16 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx) ABORT(ctx.Class); bool error = false; + for (auto a : ArgList) + { + if (a == nullptr) + { + ScriptPosition.Message(MSG_ERROR, "Empty function argument."); + delete this; + return nullptr; + } + } + PFunction *afd = FindClassMemberFunction(ctx.Class, ctx.Class, MethodName, ScriptPosition, &error); if (afd != nullptr) @@ -7071,6 +7081,16 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx) PClass *ccls = nullptr; + for (auto a : ArgList) + { + if (a == nullptr) + { + ScriptPosition.Message(MSG_ERROR, "Empty function argument."); + delete this; + return nullptr; + } + } + if (Self->ExprType == EFX_Identifier) { ccls = PClass::FindClass(static_cast(Self)->Identifier);