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

Caolán McNamara caolanm at redhat.com
Tue Feb 13 12:38:37 UTC 2018


 sw/source/filter/ww8/ww8graf2.cxx |   12 ++++++++++--
 sw/source/filter/ww8/ww8par.hxx   |    5 +++++
 2 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 5547797c6596945ef104176b6094a152f746da10
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 13 10:02:38 2018 +0000

    ofz#2980 Timeout
    
    Change-Id: Id36e0e8ae11a145b5efa976c20261af931c1d58b
    Reviewed-on: https://gerrit.libreoffice.org/49627
    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/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx
index 8a4f11102fb6..a1dbe9fc17e8 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -29,6 +29,7 @@
 #include <sfx2/app.hxx>
 #include <sfx2/docfile.hxx>
 #include <sfx2/fcontnr.hxx>
+#include <unotools/configmgr.hxx>
 #include <grfatr.hxx>
 #include <fmtanchr.hxx>
 #include <fmtcntnt.hxx>
@@ -267,12 +268,19 @@ bool SwWW8ImplReader::ReadGrafFile(OUString& rFileName, Graphic*& rpGraphic,
     }
 
     GDIMetaFile aWMF;
-    pSt->Seek( nPosFc );
-    bool bOk = ReadWindowMetafile( *pSt, aWMF );
+    bool bOk = checkSeek(*pSt, nPosFc) && ReadWindowMetafile( *pSt, aWMF );
 
     if (!bOk || pSt->GetError() || !aWMF.GetActionSize())
         return false;
 
+    //skip duplicate graphics when fuzzing
+    if (utl::ConfigManager::IsFuzzing())
+    {
+        if (m_aGrafPosSet.find(nPosFc) != m_aGrafPosSet.end())
+            return false;
+        m_aGrafPosSet.insert(nPosFc);
+    }
+
     if (m_xWwFib->m_envr != 1) // !MAC as creator
     {
         rpGraphic = new Graphic( aWMF );
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 040c5f995e0c..329cf0acfd28 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1198,6 +1198,11 @@ private:
     */
     std::vector<const SwCharFormat*> m_aRubyCharFormats;
 
+    /*
+    For fuzzing keep track of source offset of inserted graphics
+    */
+    std::set<sal_uLong> m_aGrafPosSet;
+
     WW8PostProcessAttrsInfo * m_pPostProcessAttrsInfo;
 
     std::shared_ptr<WW8Fib> m_xWwFib;


More information about the Libreoffice-commits mailing list