diff options
-rw-r--r-- | starmath/source/parse.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 41a6d482cf8f..b4541fea8bb7 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -1314,6 +1314,8 @@ std::unique_ptr<SmNode> SmParser::DoSum() { DepthProtect aDepthGuard(m_nParseDepth); + int nDepthLimit = m_nParseDepth; + auto xFirst = DoProduct(); while (TokenInGroup(TG::Sum)) { @@ -1322,7 +1324,13 @@ std::unique_ptr<SmNode> SmParser::DoSum() auto xThird = DoProduct(); xSNode->SetSubNodes(std::move(xFirst), std::move(xSecond), std::move(xThird)); xFirst = std::move(xSNode); + + ++m_nParseDepth; + DepthProtect bDepthGuard(m_nParseDepth); } + + m_nParseDepth = nDepthLimit; + return xFirst; } |