[Libreoffice-commits] core.git: 2 commits - lotuswordpro/source sc/source
Caolán McNamara
caolanm at redhat.com
Sat Feb 10 16:40:06 UTC 2018
lotuswordpro/source/filter/lwptablelayout.cxx | 5 ++++
sc/source/filter/excel/excel.cxx | 13 ------------
sc/source/filter/inc/qpro.hxx | 3 +-
sc/source/filter/qpro/qpro.cxx | 27 ++++++++++++++++++++++++--
4 files changed, 32 insertions(+), 16 deletions(-)
New commits:
commit f77f7feae7dcdc3091fe954ec6389019fea13eb8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Feb 9 15:39:24 2018 +0000
speed up qpw fuzzing, skip CalcAfterLoad
Change-Id: Ia94032d6789e830e8dbdc3093201cf8d5d44f537
Reviewed-on: https://gerrit.libreoffice.org/49507
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/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index f39766edd83a..9cfa5493e91f 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -222,19 +222,6 @@ ErrCode ScFormatFilterPluginImpl::ScExportExcel5( SfxMedium& rMedium, ScDocument
return eRet;
}
-extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportQPW(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);
- return ScFormatFilter::Get().ScImportQuattroPro(&rStream, &aDocument) == ERRCODE_NONE;
-}
-
extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportCalcRTF(SvStream &rStream)
{
ScDLL::Init();
diff --git a/sc/source/filter/inc/qpro.hxx b/sc/source/filter/inc/qpro.hxx
index 5410b8145d64..94d6c4325ddd 100644
--- a/sc/source/filter/inc/qpro.hxx
+++ b/sc/source/filter/inc/qpro.hxx
@@ -50,7 +50,8 @@ public:
sal_uInt16 getLength() { return mnLength; }
OUString readString(sal_uInt16 nLength);
- ErrCode import( ScDocument *pDoc );
+ ErrCode parse( ScDocument *pDoc );
+ ErrCode import( ScDocument *pDoc ); //parse + CalcAfterLoad
ErrCode readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pStyle );
};
#endif
diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx
index 676c297900d6..5ac793a0efec 100644
--- a/sc/source/filter/qpro/qpro.cxx
+++ b/sc/source/filter/qpro/qpro.cxx
@@ -32,6 +32,8 @@
#include <document.hxx>
#include <formulacell.hxx>
#include <tools/stream.hxx>
+#include <docoptio.hxx>
+#include <scdll.hxx>
#include <memory>
ErrCode ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pStyle )
@@ -154,8 +156,7 @@ ScQProReader::~ScQProReader()
mpStream->SetBufferSize( 0 );
}
-
-ErrCode ScQProReader::import( ScDocument *pDoc )
+ErrCode ScQProReader::parse( ScDocument *pDoc )
{
ErrCode eRet = ERRCODE_NONE;
sal_uInt16 nVersion;
@@ -223,10 +224,32 @@ ErrCode ScQProReader::import( ScDocument *pDoc )
break;
}
}
+ return eRet;
+}
+
+ErrCode ScQProReader::import( ScDocument *pDoc )
+{
+ ErrCode eRet = parse(pDoc);
pDoc->CalcAfterLoad();
return eRet;
}
+extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportQPW(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);
+
+ ScQProReader aReader(&rStream);
+ ErrCode eRet = aReader.parse(&aDocument);
+ return eRet == ERRCODE_NONE;
+}
+
bool ScQProReader::recordsLeft()
{
return mpStream && mpStream->good();
commit a9847cb1a5d231226eac58e22a4fe2705707817e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Feb 9 15:06:30 2018 +0000
ofz: Infinite loop
Change-Id: I9344cb70aab0fbaa194d431928eba9806d76f115
Reviewed-on: https://gerrit.libreoffice.org/49504
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/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index f8793328cd9b..eb94eaea6758 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -82,6 +82,7 @@
#include "lwpframelayout.hxx"
#include <xfilter/xfparastyle.hxx>
#include <memory>
+#include <set>
LwpSuperTableLayout::LwpSuperTableLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
: LwpPlacableLayout(objHdr, pStrm)
@@ -230,8 +231,10 @@ double LwpSuperTableLayout::GetTableWidth()
LwpObjectID& rColumnID = pTableLayout->GetColumnLayoutHead();
LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColumnID.obj().get());
double dColumnWidth = dDefaultWidth;
+ std::set<LwpColumnLayout*> aSeen;
while (pColumnLayout)
{
+ aSeen.insert(pColumnLayout);
if(pColumnLayout->GetColumnID() == i)
{
dColumnWidth = pColumnLayout->GetWidth();
@@ -239,6 +242,8 @@ double LwpSuperTableLayout::GetTableWidth()
}
rColumnID = pColumnLayout->GetNext();
pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColumnID.obj().get());
+ if (aSeen.find(pColumnLayout) != aSeen.end())
+ throw std::runtime_error("loop in conversion");
}
dWidth += dColumnWidth;
}
More information about the Libreoffice-commits
mailing list