summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-13 10:02:38 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-02-13 13:38:15 +0100
commit5547797c6596945ef104176b6094a152f746da10 (patch)
treea887148fdfba14c6a4c3de597d3ff5e4bd4d924a /sw
parentd34dcde1d0ccee2d78eea08185f12949f53ceae3 (diff)
ofz#2980 Timeout
Change-Id: Id36e0e8ae11a145b5efa976c20261af931c1d58b Reviewed-on: https://gerrit.libreoffice.org/49627 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/ww8graf2.cxx12
-rw-r--r--sw/source/filter/ww8/ww8par.hxx5
2 files changed, 15 insertions, 2 deletions
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;