[Libreoffice-commits] core.git: xmlsecurity/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Oct 27 18:21:29 UTC 2016


 xmlsecurity/source/pdfio/pdfdocument.cxx |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 4beac67a2ba1e63e2b47ab54a34cb3e9af77b593
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Oct 27 17:34:35 2016 +0200

    xmlsecurity PDF verify: handle missing trailer
    
    Support for Cross-Reference Streams is still missing, but this avoids
    a crash at least.
    
    Change-Id: I8c5d16531f8603feeebe8feddb7c3bdfa61943cb

diff --git a/xmlsecurity/source/pdfio/pdfdocument.cxx b/xmlsecurity/source/pdfio/pdfdocument.cxx
index a0e00ef..1ca7361 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<PDFNumberElement*>(m_pTrailer->Lookup("Prev"));
         if (pPrev)
             nStartXRef = pPrev->GetValue();


More information about the Libreoffice-commits mailing list