[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - 2 commits - filter/source lotuswordpro/source

Caolán McNamara caolanm at redhat.com
Fri Dec 8 14:19:20 UTC 2017


 filter/source/msfilter/msdffimp.cxx      |    5 ++++-
 lotuswordpro/source/filter/lwplayout.cxx |   15 ++++++++++++---
 lotuswordpro/source/filter/lwplayout.hxx |    1 +
 3 files changed, 17 insertions(+), 4 deletions(-)

New commits:
commit 721d5f525ad94df9623a8ca8c81254707faf3746
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Dec 7 08:56:44 2017 +0000

    ofz#4548 infinite regress in GetUsePrinterSettings
    
    Change-Id: Id4505f9a4ddc47f2eb45cb86d46fdd050b007c26
    Reviewed-on: https://gerrit.libreoffice.org/46024
    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/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 34ae225a3920..27dbc48cc9b8 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -81,6 +81,7 @@ LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader const &objHdr, LwpSvStream* p
     , m_bGettingIsProtected(false)
     , m_bGettingMarginsValue(false)
     , m_bGettingExtMarginsValue(false)
+    , m_bGettingUsePrinterSettings(false)
     , m_nAttributes(0)
     , m_nAttributes2(0)
     , m_nAttributes3(0)
@@ -1437,19 +1438,27 @@ XFBGImage* LwpMiddleLayout::GetXFBGImage()
 */
 bool LwpMiddleLayout::GetUsePrinterSettings()
 {
+    if (m_bGettingUsePrinterSettings)
+        throw std::runtime_error("recursion in layout");
+    m_bGettingUsePrinterSettings = true;
+
+    bool bRet = false;
+
     if(m_nOverrideFlag & OVER_SIZE)
     {
-        return (m_nAttributes3 & STYLE3_USEPRINTERSETTINGS) != 0;
+        bRet = (m_nAttributes3 & STYLE3_USEPRINTERSETTINGS) != 0;
     }
     else
     {
         rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
         if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
         {
-            return pLay->GetUsePrinterSettings();
+            bRet = pLay->GetUsePrinterSettings();
         }
     }
-    return false;
+
+    m_bGettingUsePrinterSettings = false;
+    return bRet;
 }
 
 //Check whether there are contents in the layout
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index e6b5fe849e5d..2f23271a28a2 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -226,6 +226,7 @@ protected:
     bool m_bGettingIsProtected;
     bool m_bGettingMarginsValue;
     bool m_bGettingExtMarginsValue;
+    bool m_bGettingUsePrinterSettings;
     sal_uInt32 m_nAttributes;
     sal_uInt32 m_nAttributes2;
     sal_uInt32 m_nAttributes3;
commit c8b76656c46d0d455393faec8d54f3a12c5ec617
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Dec 7 20:52:18 2017 +0000

    tdf#114304 break rather than return false on dodgy record length
    
    Change-Id: I1bc8c400147beb8688ed3afd7402b3d3f68a4a3a
    Reviewed-on: https://gerrit.libreoffice.org/46044
    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/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 38d7e5ed9e8d..a90109396b45 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -6202,7 +6202,10 @@ bool SvxMSDffManager::GetShapeContainerData( SvStream& rSt,
         else
         {
             if (!checkSeek(rSt, rSt.Tell() + nLength))
-                return false;
+            {
+                SAL_WARN("filter.ms", "remaining record longer than available data, ppt or parser is wrong");
+                break;
+            }
             nReadSpCont += nLength;
         }
     }


More information about the Libreoffice-commits mailing list