[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - starmath/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 30 10:07:01 UTC 2020


 starmath/source/parse.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 12e30b658d0adfd00c463be8a7f0d6cf91ee0974
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Nov 29 20:32:45 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Nov 30 11:06:23 2020 +0100

    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 at redhat.com>

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;
 }
 


More information about the Libreoffice-commits mailing list