diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-02-11 09:21:46 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-02-11 11:00:44 +0100 |
commit | f55914f7be1209718ff96527653cc33cd80f9d2e (patch) | |
tree | 03438abf886cfa6db42fd504d237917e0ee5b9b9 /xmlsecurity | |
parent | 67785148837b4ba5ebef1b2cdf249a8f8cad8b9d (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
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/source/helper/xmlsignaturehelper2.cxx | 6 |
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(); |