Kaydet (Commit) 26eb0deb authored tarafından Mike Kaganski's avatar Mike Kaganski Kaydeden (comit) Andras Timar

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/19963Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarAndras Timar <andras.timar@collabora.com>
üst fbb00383
...@@ -2901,6 +2901,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf89165, "tdf89165.docx") ...@@ -2901,6 +2901,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf89165, "tdf89165.docx")
// This must not hang in layout // This must not hang in layout
} }
DECLARE_OOXMLIMPORT_TEST(testTdf95777, "tdf95777.docx")
{
// This must not fail on open
}
DECLARE_OOXMLIMPORT_TEST(testTdf94374, "hello.docx") DECLARE_OOXMLIMPORT_TEST(testTdf94374, "hello.docx")
{ {
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
......
...@@ -125,7 +125,14 @@ void OOXMLOLEHandler::attribute(Id name, Value & val) ...@@ -125,7 +125,14 @@ void OOXMLOLEHandler::attribute(Id name, Value & val)
switch (name) switch (name)
{ {
case NS_ooxml::LN_CT_OLEObject_r_id: 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; break;
default: default:
; ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment