From 15640ff937966c963ff1d1a10d04d63a94f7de47 Mon Sep 17 00:00:00 2001 From: wghost Date: Fri, 3 Apr 2015 15:35:07 +0400 Subject: [PATCH] unresolved references check added --- ModScript.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ModScript.cpp b/ModScript.cpp index 9545ee1..863044b 100644 --- a/ModScript.cpp +++ b/ModScript.cpp @@ -1913,6 +1913,12 @@ std::string ModScript::ParseScript(std::string ScriptData, unsigned* ScriptMemSi do { needSecondPass = false; + if (numPasses > 10) + { + *ErrorMessages << "Infinite loop detected (numPasses > 10)!" << std::endl; + SetBad(); + return std::string(""); + } if (numPasses != 0) /// no need to parse twice { WorkingData.str(ScriptHEX.str()); @@ -1998,6 +2004,12 @@ std::string ModScript::ParseScript(std::string ScriptData, unsigned* ScriptMemSi { ScriptHEX << NextWord << " "; needSecondPass = true; + if (numPasses != 0 && MarkerLabels.size() == 0) + { + *ErrorMessages << "Unresolved reference: " << NextWord << std::endl; + SetBad(); + return std::string(""); + } } } if (numPasses == 0)