From e68b7938522a836e0e0033a84e0dfd03b17e7328 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 23 Aug 2021 14:19:33 +1000 Subject: [PATCH] - Add some extra safety to `defineqav` parser to ensure some unsupported actions can't be performed. --- source/core/defparser.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/core/defparser.cpp b/source/core/defparser.cpp index 4d8c68a8d..d8644ffd9 100644 --- a/source/core/defparser.cpp +++ b/source/core/defparser.cpp @@ -2098,6 +2098,11 @@ static bool parseDefineQAVInterpolateBlock(FScanner& sc, const int& res_id, cons sc.GetString(); if (sc.Compare("type")) { + if (interptype.IsNotEmpty()) + { + pos.Message(MSG_ERROR, "defineqav (%d): interpolate (%s): more than one interpolation type defined, unable to continue", res_id, interptype.GetChars()); + return false; + } sc.GetString(interptype); if (!gi->IsQAVInterpTypeValid(interptype)) { @@ -2138,6 +2143,11 @@ void parseDefineQAV(FScanner& sc, FScriptPosition& pos) sc.MustGetString(); if (sc.Compare("file")) { + if (fn.IsNotEmpty()) + { + pos.Message(MSG_ERROR, "defineqav (%d): more than one file defined, unable to continue", res_id); + return; + } sc.GetString(fn); // Test file's validity. @@ -2156,6 +2166,11 @@ void parseDefineQAV(FScanner& sc, FScriptPosition& pos) } else if (sc.Compare("interpolate")) { + if (interpolate) + { + pos.Message(MSG_ERROR, "defineqav (%d): more than one interpolate block defined, unable to continue", res_id); + return; + } interpolate = true; if (!parseDefineQAVInterpolateBlock(sc, res_id, numframes)) return; }