From 4beac67a2ba1e63e2b47ab54a34cb3e9af77b593 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 27 Oct 2016 17:34:35 +0200 Subject: [PATCH] xmlsecurity PDF verify: handle missing trailer Support for Cross-Reference Streams is still missing, but this avoids a crash at least. Change-Id: I8c5d16531f8603feeebe8feddb7c3bdfa61943cb --- xmlsecurity/source/pdfio/pdfdocument.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xmlsecurity/source/pdfio/pdfdocument.cxx b/xmlsecurity/source/pdfio/pdfdocument.cxx index a0e00ef8f3f5..1ca73618cff5 100644 --- a/xmlsecurity/source/pdfio/pdfdocument.cxx +++ b/xmlsecurity/source/pdfio/pdfdocument.cxx @@ -909,6 +909,13 @@ bool PDFDocument::Read(SvStream& rStream) SAL_WARN("xmlsecurity.pdfio", "PDFDocument::Read: failed to tokenizer trailer after xref"); return false; } + + if (!m_pTrailer) + { + SAL_WARN("xmlsecurity.pdfio", "PDFDocument::Read: found no trailer"); + return false; + } + auto pPrev = dynamic_cast(m_pTrailer->Lookup("Prev")); if (pPrev) nStartXRef = pPrev->GetValue();