[Libreoffice-commits] core.git: lotuswordpro/source

Caolán McNamara caolanm at redhat.com
Mon Feb 19 20:45:17 UTC 2018


 lotuswordpro/source/filter/lwptablelayout.cxx |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 1404b82e8d4fb9c809cfe478807d3831b2c924a0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Feb 19 14:40:15 2018 +0000

    ofz: infinite loop
    
    Change-Id: I2230a3fdd602063e66f56d23c15f79d6d4de4c8a
    Reviewed-on: https://gerrit.libreoffice.org/50000
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index 81ee8213ff16..33a7b412efa7 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -451,8 +451,11 @@ void LwpTableLayout::TraverseTable()
     // set value
     LwpObjectID& rRowID = GetChildHead();
     LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get());
+    std::set<LwpRowLayout*> aSeen;
     while (pRowLayout)
     {
+        aSeen.insert(pRowLayout);
+
         pRowLayout->SetRowMap();
 
         // for 's analysis job
@@ -462,6 +465,8 @@ void LwpTableLayout::TraverseTable()
 
         rRowID = pRowLayout->GetNext();
         pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get());
+        if (aSeen.find(pRowLayout) != aSeen.end())
+            throw std::runtime_error("loop in conversion");
     }
 }
 
@@ -563,8 +568,11 @@ void LwpTableLayout::RegisterColumns()
     // NOTICE: all default columns are regarded as justifiable columns
     LwpObjectID& rColumnID = GetColumnLayoutHead();
     LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColumnID.obj().get());
+    std::set<LwpColumnLayout*> aSeen;
     while (pColumnLayout)
     {
+        aSeen.insert(pColumnLayout);
+
         auto nColId = pColumnLayout->GetColumnID();
         if (nColId >= nCols)
         {
@@ -580,6 +588,9 @@ void LwpTableLayout::RegisterColumns()
 
         rColumnID = pColumnLayout->GetNext();
         pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColumnID.obj().get());
+
+        if (aSeen.find(pColumnLayout) != aSeen.end())
+            throw std::runtime_error("loop in conversion");
     }
 
     // if all columns are not justifiable, the rightmost column will be changed to justifiable


More information about the Libreoffice-commits mailing list