summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2015-11-14 21:12:49 +1000
committerAndras Timar <andras.timar@collabora.com>2016-01-05 09:25:51 +0000
commit933f9da205632de75740cfd71443cbd908a18676 (patch)
tree06b59d23e6f715af2906c3bfcacc92ff7e22aac1
parente66076c33b5875e68167b53fd9d663f4abd566c8 (diff)
tdf#69640: Treat errors opening OLE stream gracefully
The testcase for tdf#69640 includes links (relations) to external pptx files. It demonstrates two non-fatal reasons for failure opening OLE stream: 1. it fails OStorageHelper::IsValidZipEntryFileName check, because the file path contains ":\"; 2. even if that were not the case, the required file can be absent from user's system. I suppose that intercepting the failure at the level of OOXMLOLEHandler::attribute() is the best option, because at the lower level it's unknown if this failure is fatal or not. I suppose that it could be also useful to intercept specifically failures in OStorageHelper::IsValidZipEntryFileName, checking if the file exist externally, and asking users if they want to update external links (as MSO does). Possibly it should be discussed with UX team if that should be done, and if so, do it in separate commit. Change-Id: I240a6f69abe236eb790bb406c79f3b761fb4638a Reviewed-on: https://gerrit.libreoffice.org/19963 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Andras Timar <andras.timar@collabora.com> (cherry picked from commit 26eb0debda788d996d9bd63d72947652a5066087) Reviewed-on: https://gerrit.libreoffice.org/21105
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf95777.docxbin0 -> 19126 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx5
-rw-r--r--writerfilter/source/ooxml/Handler.cxx9
3 files changed, 13 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf95777.docx b/sw/qa/extras/ooxmlimport/data/tdf95777.docx
new file mode 100644
index 000000000000..e71fdea609b6
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf95777.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index e19d1ba4c91e..40949b2edbc6 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2901,6 +2901,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf89165, "tdf89165.docx")
// This must not hang in layout
}
+DECLARE_OOXMLIMPORT_TEST(testTdf95777, "tdf95777.docx")
+{
+ // This must not fail on open
+}
+
DECLARE_OOXMLIMPORT_TEST(testTdf94374, "hello.docx")
{
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
diff --git a/writerfilter/source/ooxml/Handler.cxx b/writerfilter/source/ooxml/Handler.cxx
index 89d7cdbfb40a..2010be429d81 100644
--- a/writerfilter/source/ooxml/Handler.cxx
+++ b/writerfilter/source/ooxml/Handler.cxx
@@ -125,7 +125,14 @@ void OOXMLOLEHandler::attribute(Id name, Value & val)
switch (name)
{
case NS_ooxml::LN_CT_OLEObject_r_id:
- mpFastContext->resolveData(val.getString());
+ try {
+ mpFastContext->resolveData(val.getString());
+ }
+ catch (const ::css::uno::Exception&)
+ {
+ // Can't resolve OLE stream
+ SAL_WARN("OOXMLOLEHandler::attribute", "Failed to open OLE stream!");
+ }
break;
default:
;