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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 28 13:55:29 UTC 2020


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

New commits:
commit 018bf569904e77e897b9b76f17a9b539cc415dcc
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jan 28 10:46:01 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jan 28 14:54:53 2020 +0100

    ofz#20361 infinite recursion
    
    Change-Id: I2434df7a08ddbc557879404504d3adc30e04d683
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87599
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index d9b442268b04..9d8b33fa94b5 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -88,6 +88,7 @@ LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader const &objHdr, LwpSvStream* p
     , m_bGettingBorderStuff(false)
     , m_bGettingUseWhen(false)
     , m_bGettingStyleLayout(false)
+    , m_bGettingAutoGrowUp(false)
     , m_nAttributes(0)
     , m_nAttributes2(0)
     , m_nAttributes3(0)
@@ -1189,19 +1190,27 @@ bool LwpMiddleLayout::IsAutoGrowDown()
 */
 bool LwpMiddleLayout::IsAutoGrowUp()
 {
-    if(m_nOverrideFlag & OVER_SIZE)
+    if (m_bGettingAutoGrowUp)
+        throw std::runtime_error("recursion in layout");
+    m_bGettingAutoGrowUp = true;
+
+    bool bRet;
+
+    if (m_nOverrideFlag & OVER_SIZE)
     {
-        return (m_nDirection & (LAY_AUTOGROW << SHIFT_UP)) != 0;
+        bRet = (m_nDirection & (LAY_AUTOGROW << SHIFT_UP)) != 0;
     }
     else
     {
         rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
         if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
-        {
-            return pLay->IsAutoGrowUp();
-        }
+            bRet = pLay->IsAutoGrowUp();
+        else
+            bRet = LwpVirtualLayout::IsAutoGrowUp();
     }
-    return LwpVirtualLayout::IsAutoGrowUp();
+
+    m_bGettingAutoGrowUp = false;
+    return bRet;
 }
 
 /**
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index c68a82d1edd3..c11f830c83a5 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -240,6 +240,7 @@ protected:
     bool m_bGettingBorderStuff;
     bool m_bGettingUseWhen;
     bool m_bGettingStyleLayout;
+    bool m_bGettingAutoGrowUp;
     sal_uInt32 m_nAttributes;
     sal_uInt32 m_nAttributes2;
     sal_uInt32 m_nAttributes3;


More information about the Libreoffice-commits mailing list