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

Caolán McNamara caolanm at redhat.com
Wed Jan 3 16:02:05 UTC 2018


 lotuswordpro/source/filter/lwplayout.cxx |   16 +++++++++++-----
 lotuswordpro/source/filter/lwplayout.hxx |    1 +
 2 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit a71ce08da071a205aba15c32ae9c42b4b5e44018
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Dec 19 09:18:54 2017 +0000

    ofz#4689 avoid recurse to death
    
    Change-Id: Ie578a767cd8646c4e67c302a67b46ce1f1637122
    Reviewed-on: https://gerrit.libreoffice.org/46774
    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 6f0fec06c58b..b000fdbda6c1 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -1942,6 +1942,7 @@ rtl::Reference<LwpVirtualLayout> LwpLayout::GetContainerLayout()
 LwpPlacableLayout::LwpPlacableLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm )
     : LwpLayout(objHdr, pStrm)
     , m_bGettingWrapType(false)
+    , m_bGettingLayoutRelativity(false)
     , m_nWrapType(0)
     , m_nBuoyancy(0)
     , m_nBaseLineOffset(0)
@@ -2021,11 +2022,15 @@ sal_uInt8 LwpPlacableLayout::GetWrapType()
 */
 LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece()
 {
-    if(!m_LayRelativity.IsNull())
+    if (m_bGettingLayoutRelativity)
+        throw std::runtime_error("recursion in layout");
+    m_bGettingLayoutRelativity = true;
+    LwpLayoutRelativity* pRet = nullptr;
+    if (!m_LayRelativity.IsNull())
     {
-        if(m_nOverrideFlag & OVER_PLACEMENT)
+        if (m_nOverrideFlag & OVER_PLACEMENT)
         {
-            return dynamic_cast<LwpLayoutRelativity*>(m_LayRelativity.obj().get());
+            pRet = dynamic_cast<LwpLayoutRelativity*>(m_LayRelativity.obj().get());
         }
     }
     else
@@ -2033,10 +2038,11 @@ LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece()
         rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
         if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(xBase.get()))
         {
-            return pLay->GetRelativityPiece();
+            pRet = pLay->GetRelativityPiece();
         }
     }
-    return nullptr;
+    m_bGettingLayoutRelativity = false;
+    return pRet;
 }
 /**
 * @descr:   Get relative type
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index 2fdfb421362e..1a46b6ab3d07 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -497,6 +497,7 @@ protected:
     void Read() override;
 protected:
     bool m_bGettingWrapType;
+    bool m_bGettingLayoutRelativity;
     sal_uInt8 m_nWrapType;
     sal_uInt8 m_nBuoyancy;
     sal_Int32 m_nBaseLineOffset;


More information about the Libreoffice-commits mailing list