summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-02-11 09:21:46 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-07 12:24:37 +0200
commit168082bea1757fff6ce8ec6e826e5f457953216c (patch)
tree4949e3b3db7be907308a62fd67d9f82cf3f3dbe6 /xmlsecurity
parenta1518507fefc344a6152a18558b9ab49941c217b (diff)
xmlsecurity: avoid throwing io::IOException when OOXML export misbehaves
The root cause (and that still needs fixing) is that the OOXML signature export fails to start same-document references with a "#" character. OTOH, even if that happens, it's better to throw uno::RuntimeException in UriBindingHelper::OpenInputStream() to avoid std::terminate(). Change-Id: I9c9c211de36fb0aeb2c33f62b094c9f4d9c85b3d (cherry picked from commit f55914f7be1209718ff96527653cc33cd80f9d2e)
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/helper/xmlsignaturehelper2.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper2.cxx b/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
index ebc8a1d8f051..314079510efa 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
@@ -205,7 +205,11 @@ uno::Reference < io::XInputStream > UriBindingHelper::OpenInputStream( const uno
throw uno::Exception("Could not decode URI for stream element.", nullptr);
uno::Reference< io::XStream > xStream;
- xStream = rxStore->cloneStreamElement( sName );
+ uno::Reference<container::XNameAccess> xNameAccess(rxStore, uno::UNO_QUERY);
+ if (!xNameAccess->hasByName(sName))
+ SAL_WARN("xmlsecurity.helper", "expected stream, but not found: " << sName);
+ else
+ xStream = rxStore->cloneStreamElement( sName );
if ( !xStream.is() )
throw uno::RuntimeException();
xInStream = xStream->getInputStream();