From 94e7b6f3b5fc1efc48506229426f7067eb28213a Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 22 Oct 2019 11:11:22 +0300 Subject: [PATCH] - do not accept read-only variable as out argument https://forum.zdoom.org/viewtopic.php?t=66179 --- src/scripting/backend/codegen.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 786d6164c..08d3ac37a 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -9047,6 +9047,14 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx) else { ArgList[i]->RequestAddress(ctx, &writable); + + if ((flag & VARF_Out) && !writable) + { + ScriptPosition.Message(MSG_ERROR, "Argument must be a modifiable value"); + delete this; + return nullptr; + } + if (flag & VARF_Ref)ArgList[i]->ValueType = NewPointer(ArgList[i]->ValueType); }