summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-11-29 20:32:45 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-11-30 11:06:08 +0100
commit080aa7c89fa6b35d8ea8435636c5965bf01e3661 (patch)
tree8f9bbc1c18070e657e69f82723fa2d44053c13ad /starmath
parent81ecdd52ef2f3d390327a0bf6b6fa906805843f7 (diff)
ofz#27892 recursion too deep
which appeared after... commit 8c716704df4aaa83fcd198cc8d92cd3e1e542de9 tdf#38885 Remove createTextFromNode Change-Id: I741135cec946c72e6643437eb2941cf3548901bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106845 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'starmath')
-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 b558da047cc0..e1ec6e3f9d61 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;
}