[Libreoffice-commits] core.git: 2 commits - sc/source sw/source
Caolán McNamara
caolanm at redhat.com
Fri Feb 16 15:40:44 UTC 2018
sc/source/filter/excel/excel.cxx | 16 ----------------
sc/source/filter/inc/lotimpop.hxx | 1 +
sc/source/filter/lotus/lotread.cxx | 35 +++++++++++++++++++++++++++++++++--
sc/source/filter/lotus/lotus.cxx | 4 +---
sw/source/filter/ww8/ww8graf.cxx | 3 ++-
5 files changed, 37 insertions(+), 22 deletions(-)
New commits:
commit 840e4dd1a4986e4560264c5492fe486924eb1eb5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Feb 16 12:21:48 2018 +0000
ofz#6414 Integer-overflow
Change-Id: I1090711877707b9e66aef36910eca2df81c7c3b6
Reviewed-on: https://gerrit.libreoffice.org/49858
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/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index da262f684feb..f628098fbe3d 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -93,6 +93,7 @@
#include <svx/hlnkitem.hxx>
#include <svl/whiter.hxx>
#include <o3tl/enumrange.hxx>
+#include <o3tl/safeint.hxx>
#include <memory>
#include <filter/msfilter/escherex.hxx>
#include "sprmids.hxx"
@@ -2319,7 +2320,7 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec* pRecord,
// floating screen objects, which are imported.
{
// Miserable miserable hack.
- SwTwips nWidth = (pFSPA->nXaRight - pFSPA->nXaLeft);
+ SwTwips nWidth = o3tl::saturating_sub(pFSPA->nXaRight, pFSPA->nXaLeft);
SwTwips nLeft = pFSPA->nXaLeft;
if (MiserableRTLGraphicsHack(nLeft, nWidth, eHoriOri,
eHoriRel))
commit 832ba85ebfa6d546aa4c3e373987f767a104f192
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Feb 16 12:54:52 2018 +0000
ofz#5951 speed up wks fuzzing, skip CalcAfterLoad
Change-Id: I942480742da9aec18409b2d31dd68a01275682f9
Reviewed-on: https://gerrit.libreoffice.org/49859
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index 9cfa5493e91f..797124a280d0 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -271,22 +271,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportXLS(SvStream& rStream)
return bRet;
}
-extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportWKS(SvStream& rStream)
-{
- ScDLL::Init();
- SfxMedium aMedium;
- css::uno::Reference<css::io::XInputStream> xStm(new utl::OInputStreamWrapper(rStream));
- aMedium.GetItemSet()->Put(SfxUnoAnyItem(SID_INPUTSTREAM, css::uno::makeAny(xStm)));
- ScDocument aDocument;
- ScDocOptions aDocOpt = aDocument.GetDocOptions();
- aDocOpt.SetLookUpColRowNames(false);
- aDocument.SetDocOptions(aDocOpt);
- aDocument.MakeTable(0);
- aDocument.EnableExecuteLink(false);
- aDocument.SetInsertingFromOtherDoc(true);
- return ScFormatFilter::Get().ScImportLotus123(aMedium, &aDocument, RTL_TEXTENCODING_ASCII_US) == ERRCODE_NONE;
-}
-
extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportDIF(SvStream &rStream)
{
ScDLL::Init();
diff --git a/sc/source/filter/inc/lotimpop.hxx b/sc/source/filter/inc/lotimpop.hxx
index 894a89c26e7a..17fca962caf6 100644
--- a/sc/source/filter/inc/lotimpop.hxx
+++ b/sc/source/filter/inc/lotimpop.hxx
@@ -79,6 +79,7 @@ public:
virtual ~ImportLotus() override;
+ ErrCode parse(); //parse + CalcAfterLoad
ErrCode Read() override;
ErrCode Read( SvStream& ); // special for *.fm3 files
};
diff --git a/sc/source/filter/lotus/lotread.cxx b/sc/source/filter/lotus/lotread.cxx
index 23f9823629e1..6caefd0337d1 100644
--- a/sc/source/filter/lotus/lotread.cxx
+++ b/sc/source/filter/lotus/lotread.cxx
@@ -18,7 +18,9 @@
*/
#include <document.hxx>
+#include <docoptio.hxx>
+#include <scdll.hxx>
#include <scerrors.hxx>
#include <root.hxx>
#include "lotfilter.hxx"
@@ -28,7 +30,7 @@
class ScFormulaCell;
-ErrCode ImportLotus::Read()
+ErrCode ImportLotus::parse()
{
enum STATE
{
@@ -223,8 +225,13 @@ ErrCode ImportLotus::Read()
}
}
- pD->CalcAfterLoad();
+ return eRet;
+}
+ErrCode ImportLotus::Read()
+{
+ ErrCode eRet = parse();
+ pD->CalcAfterLoad();
return eRet;
}
@@ -307,4 +314,28 @@ ErrCode ImportLotus::Read(SvStream& rIn)
return eRet;
}
+extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportWKS(SvStream& rStream)
+{
+ ScDLL::Init();
+ ScDocument aDocument;
+ ScDocOptions aDocOpt = aDocument.GetDocOptions();
+ aDocOpt.SetLookUpColRowNames(false);
+ aDocument.SetDocOptions(aDocOpt);
+ aDocument.MakeTable(0);
+ aDocument.EnableExecuteLink(false);
+ aDocument.SetInsertingFromOtherDoc(true);
+
+ LotusContext aContext;
+ ImportLotus aLotusImport(aContext, rStream, &aDocument, RTL_TEXTENCODING_ASCII_US);
+
+ ErrCode eRet = aLotusImport.parse();
+ if (eRet == ErrCode(0xFFFFFFFF))
+ {
+ rStream.Seek(0);
+ eRet = ScImportLotus123old(aContext, rStream, &aDocument, RTL_TEXTENCODING_ASCII_US);
+ }
+
+ return eRet == ERRCODE_NONE;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/lotus/lotus.cxx b/sc/source/filter/lotus/lotus.cxx
index 7228153dbabb..5b7260434343 100644
--- a/sc/source/filter/lotus/lotus.cxx
+++ b/sc/source/filter/lotus/lotus.cxx
@@ -22,7 +22,6 @@
#include <sfx2/docfile.hxx>
#include <tools/urlobj.hxx>
-#include <unotools/configmgr.hxx>
#include <scerrors.hxx>
#include <root.hxx>
@@ -43,9 +42,8 @@ ErrCode ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium& rMedium, ScDocume
ImportLotus aLotusImport(aContext, *pStream, pDocument, eSrc);
- const bool bWithWK3 = utl::ConfigManager::IsFuzzing() || ScFilterOptions().GetWK3Flag();
ErrCode eRet;
- if (bWithWK3)
+ if (ScFilterOptions().GetWK3Flag())
eRet = aLotusImport.Read();
else
eRet = ErrCode(0xFFFFFFFF); // force WK1 /WKS
More information about the Libreoffice-commits
mailing list