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>
This commit is contained in:
Miklos Vajna 2016-11-08 15:54:15 +01:00
parent 5d80555938
commit 62401ba3c9

View File

@ -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)
{