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

Caolán McNamara caolanm at redhat.com
Sat Feb 17 17:53:48 UTC 2018


 lotuswordpro/source/filter/lwpdoc.cxx       |    4 ++++
 lotuswordpro/source/filter/lwprowlayout.cxx |    5 +++++
 2 files changed, 9 insertions(+)

New commits:
commit 7a4eaf4a74832621d8ae2525ee93501ed315e590
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 17 14:47:10 2018 +0000

    ofz: infinite loop
    
    Change-Id: Ie54c22c65ccd962862cade77e3502a264164c2b2
    Reviewed-on: https://gerrit.libreoffice.org/49912
    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/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx
index 8e90b856da45..02d9d221b304 100644
--- a/lotuswordpro/source/filter/lwprowlayout.cxx
+++ b/lotuswordpro/source/filter/lwprowlayout.cxx
@@ -68,6 +68,7 @@
 #include <xfilter/xftable.hxx>
 #include <xfilter/xfcell.hxx>
 #include <xfilter/xfcellstyle.hxx>
+#include <set>
 
 LwpRowLayout::LwpRowLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
     : LwpVirtualLayout(objHdr, pStrm)
@@ -95,12 +96,16 @@ void LwpRowLayout::SetRowMap()
     LwpObjectID& rCellID= GetChildHead();
     LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get());
 
+    std::set<LwpCellLayout*> aSeen;
     while(pCellLayout)
     {
+        aSeen.insert(pCellLayout);
         pCellLayout->SetCellMap();
 
         rCellID = pCellLayout->GetNext();
         pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get());
+        if (aSeen.find(pCellLayout) != aSeen.end())
+            throw std::runtime_error("loop in conversion");
     }
 }
 /**
commit d265bb1554c185ab9cd5bd63e584165e8b3ae0a1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 17 14:50:30 2018 +0000

    ofz: infinite loop
    
    Change-Id: Icbc19a6761a9972d61db45b779dab56361bf6db8
    Reviewed-on: https://gerrit.libreoffice.org/49915
    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/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx
index 6bb3c94aedb5..728df2e413b8 100644
--- a/lotuswordpro/source/filter/lwpdoc.cxx
+++ b/lotuswordpro/source/filter/lwpdoc.cxx
@@ -562,8 +562,10 @@ LwpDocument* LwpDocument::GetLastDivisionWithContents()
     {
         LwpDocument* pDivision = GetLastDivision();
 
+        std::set<LwpDocument*> aSeen;
         while (pDivision && pDivision != this)
         {
+            aSeen.insert(pDivision);
             LwpDocument* pContentDivision = pDivision->GetLastDivisionWithContents();
             if (pContentDivision)
             {
@@ -571,6 +573,8 @@ LwpDocument* LwpDocument::GetLastDivisionWithContents()
                 break;
             }
             pDivision = pDivision->GetPreviousDivision();
+            if (aSeen.find(pDivision) != aSeen.end())
+                throw std::runtime_error("loop in conversion");
         }
     }
 


More information about the Libreoffice-commits mailing list