[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - lotuswordpro/source

Caolán McNamara caolanm at redhat.com
Tue Dec 12 12:12:18 UTC 2017


 lotuswordpro/source/filter/lwplayout.cxx |   14 ++++++++++----
 lotuswordpro/source/filter/lwplayout.hxx |    1 +
 2 files changed, 11 insertions(+), 4 deletions(-)

New commits:
commit 465c432599e68f84b86a221c14074830f8c82083
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Dec 12 09:51:55 2017 +0000

    ofz#4600 avoid recurse to death
    
    Change-Id: I3cdced8294b30df5936bf7e167ca8a4950dde652
    Reviewed-on: https://gerrit.libreoffice.org/46286
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 6072a6955ab5..6f0fec06c58b 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -1941,6 +1941,7 @@ rtl::Reference<LwpVirtualLayout> LwpLayout::GetContainerLayout()
 
 LwpPlacableLayout::LwpPlacableLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm )
     : LwpLayout(objHdr, pStrm)
+    , m_bGettingWrapType(false)
     , m_nWrapType(0)
     , m_nBuoyancy(0)
     , m_nBaseLineOffset(0)
@@ -1996,19 +1997,24 @@ void LwpPlacableLayout::Read()
 */
 sal_uInt8 LwpPlacableLayout::GetWrapType()
 {
-    if(m_nOverrideFlag & OVER_PLACEMENT)
+    if (m_bGettingWrapType)
+        throw std::runtime_error("recursion in layout");
+    m_bGettingWrapType = true;
+    sal_uInt8 nWrapType = LAY_WRAP_AROUND;
+    if (m_nOverrideFlag & OVER_PLACEMENT)
     {
-        return m_nWrapType;
+        nWrapType = m_nWrapType;
     }
     else
     {
         rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
         if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(xBase.get()))
         {
-            return pLay->GetWrapType();
+            nWrapType = pLay->GetWrapType();
         }
     }
-    return LAY_WRAP_AROUND;
+    m_bGettingWrapType = false;
+    return nWrapType;
 }
 /**
  * @descr:  get LayoutRelativity
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index 1a66d4e66c72..2fdfb421362e 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -496,6 +496,7 @@ public:
 protected:
     void Read() override;
 protected:
+    bool m_bGettingWrapType;
     sal_uInt8 m_nWrapType;
     sal_uInt8 m_nBuoyancy;
     sal_Int32 m_nBaseLineOffset;


More information about the Libreoffice-commits mailing list