summaryrefslogtreecommitdiff
path: root/starmath/source/parse.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'starmath/source/parse.cxx')
-rw-r--r--starmath/source/parse.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 4ac26866e07c..a2c4e3382517 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -1266,6 +1266,8 @@ std::unique_ptr<SmNode> SmParser::DoRelation()
if (aDepthGuard.TooDeep())
throw std::range_error("parser depth limit");
+ int nDepthLimit = m_nParseDepth;
+
auto xFirst = DoSum();
while (TokenInGroup(TG::Relation))
{
@@ -1274,7 +1276,14 @@ std::unique_ptr<SmNode> SmParser::DoRelation()
auto xThird = DoSum();
xSNode->SetSubNodes(std::move(xFirst), std::move(xSecond), std::move(xThird));
xFirst = std::move(xSNode);
+
+ ++m_nParseDepth;
+ if (aDepthGuard.TooDeep())
+ throw std::range_error("parser depth limit");
}
+
+ m_nParseDepth = nDepthLimit;
+
return xFirst;
}