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:23 +0100
commit12e30b658d0adfd00c463be8a7f0d6cf91ee0974 (patch)
treeb9425eb80a0e9e2dd49b751d48a6d4263eb0b90e /starmath
parent0c1736f2dff63f2ac4a08c2b0e4c0d9c20d693cb (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/+/106816 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 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;
}