lotuswordpro/source/filter/lwpfnlayout.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit afb022f0a399799be43a3fd3a1380b6b26350ed4
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Oct 4 20:08:44 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Oct 5 11:13:37 2021 +0200

    ofz: detect infinite loop
    
    Change-Id: Ifc3134401c4ed7c4b17faf282d191ad2bb778746
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123067
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/lotuswordpro/source/filter/lwpfnlayout.cxx 
b/lotuswordpro/source/filter/lwpfnlayout.cxx
index fbbdcb6b4873..0cdede0560d4 100644
--- a/lotuswordpro/source/filter/lwpfnlayout.cxx
+++ b/lotuswordpro/source/filter/lwpfnlayout.cxx
@@ -59,6 +59,7 @@
  */
 
 #include "lwpfnlayout.hxx"
+#include <o3tl/sorted_vector.hxx>
 
 LwpFootnoteLayout::LwpFootnoteLayout(LwpObjectHeader const& objHdr, 
LwpSvStream* pStrm)
     : LwpTableLayout(objHdr, pStrm)
@@ -111,12 +112,16 @@ void LwpFnRowLayout::RegisterStyle()
     LwpObjectID* pCellID = &GetChildHead();
     LwpCellLayout* pCellLayout = 
dynamic_cast<LwpCellLayout*>(pCellID->obj().get());
 
+    o3tl::sorted_vector<LwpCellLayout*> aSeen;
     while (pCellLayout)
     {
+        aSeen.insert(pCellLayout);
         pCellLayout->SetFoundry(m_pFoundry);
         pCellLayout->RegisterStyle();
         pCellID = &pCellLayout->GetNext();
         pCellLayout = dynamic_cast<LwpCellLayout*>(pCellID->obj().get());
+        if (aSeen.find(pCellLayout) != aSeen.end())
+            throw std::runtime_error("loop in conversion");
     }
 }
 

Reply via email to