diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-11-08 15:54:15 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-11-08 16:46:51 +0000 |
commit | 62401ba3c9df1f7234bd272b3e659a08f546d50c (patch) | |
tree | dbe342ba5bf51d5187e5647dbbdfa9189a28950f /xmlsecurity | |
parent | 5d80555938c26e1426a0d72ec40b4ec873530745 (diff) |
xmlsecurity PDF sign: don't crash on missing trailer
This will need cross-reference stream write support, just don't crash
for now.
Change-Id: Id48c131b22d4ed96174693f3e96b14c273d596a8
Reviewed-on: https://gerrit.libreoffice.org/30702
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/source/pdfio/pdfdocument.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/xmlsecurity/source/pdfio/pdfdocument.cxx b/xmlsecurity/source/pdfio/pdfdocument.cxx index 0bc2f80d6798..cd52f8d0eaac 100644 --- a/xmlsecurity/source/pdfio/pdfdocument.cxx +++ b/xmlsecurity/source/pdfio/pdfdocument.cxx @@ -478,6 +478,11 @@ bool PDFDocument::Sign(const uno::Reference<security::XCertificate>& xCertificat m_aEditBuffer.WriteCharPtr("\nendobj\n\n"); // Write the updated Catalog object, references nAnnotId. + if (!m_pTrailer) + { + SAL_WARN("xmlsecurity.pdfio", "PDFDocument::Sign: found no trailer"); + return false; + } auto pRoot = dynamic_cast<PDFReferenceElement*>(m_pTrailer->Lookup("Root")); if (!pRoot) { |