From 2ee7ad015147de33c172677b70a120f45f2e794f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 20 Mar 2017 15:51:38 +0000 Subject: [PATCH] Resolves: ofz#820 an exception is an acceptable outcome Change-Id: Ifc5be483387202c371596fd52f1e2ce682151ca8 --- hwpfilter/source/hwpreader.cxx | 33 ++++++++++++++---------- lotuswordpro/source/filter/lwpfilter.cxx | 3 +-- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index cf1dbd452d16..cf13db054a50 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -118,21 +118,28 @@ HwpReader::~HwpReader() extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportHWP(SvStream &rStream) { - std::unique_ptr stream(new HStream); - byte aData[32768]; - std::size_t nRead, nBlock = 32768; - - while (true) + try { - nRead = rStream.ReadBytes(aData, nBlock); - if (nRead == 0) - break; - stream->addData(aData, (int)nRead); - } + std::unique_ptr stream(new HStream); + byte aData[32768]; + std::size_t nRead, nBlock = 32768; - HWPFile hwpfile; - if (hwpfile.ReadHwpFile(stream.release())) - return false; + while (true) + { + nRead = rStream.ReadBytes(aData, nBlock); + if (nRead == 0) + break; + stream->addData(aData, (int)nRead); + } + + HWPFile hwpfile; + if (hwpfile.ReadHwpFile(stream.release())) + return false; + } + catch (...) + { + return false; + } return true; } diff --git a/lotuswordpro/source/filter/lwpfilter.cxx b/lotuswordpro/source/filter/lwpfilter.cxx index 8f8c8a365209..cfa6b42ff405 100644 --- a/lotuswordpro/source/filter/lwpfilter.cxx +++ b/lotuswordpro/source/filter/lwpfilter.cxx @@ -215,13 +215,12 @@ int ReadWordproFile(SvStream &rStream, uno::Reference