[poppler] 3 commits - poppler/PDFDoc.cc utils/pdfdetach.cc

Adrian Johnson ajohnson at kemper.freedesktop.org
Tue Oct 21 02:47:53 PDT 2014


 poppler/PDFDoc.cc  |    6 +++++-
 utils/pdfdetach.cc |    2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit ee4a389872d86b619c677888da8f13f1f6c54472
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Oct 20 22:32:30 2014 +1030

    PDFDoc: fix crash when getPage() returns NULL
    
    Bug 85235

diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index d1b5d7b..8fd5e18 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -626,7 +626,7 @@ int PDFDoc::savePageAs(GooString *name, int pageNo)
   int keyLength;
   xref->getEncryptionParameters(&fileKey, &encAlgorithm, &keyLength);
 
-  if (pageNo < 1 || pageNo > getNumPages()) {
+  if (pageNo < 1 || pageNo > getNumPages() || !getCatalog()->getPage(pageNo)) {
     error(errInternal, -1, "Illegal pageNo: {0:d}({1:d})", pageNo, getNumPages() );
     return errOpenFile;
   }
commit 0c3f53e34ec287dab2784e1f3411ad06b62dffc7
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Oct 20 22:17:20 2014 +1030

    PDFDOC: Check for EOF when reading raw stream
    
    Bug 85233

diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index f8ac85d..d1b5d7b 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -1039,6 +1039,10 @@ void PDFDoc::writeRawStream (Stream* str, OutStream* outStr)
   str->unfilteredReset();
   for (Goffset i = 0; i < length; i++) {
     int c = str->getUnfilteredChar();
+    if (unlikely(c == EOF)) {
+      error (errSyntaxError, -1, "PDFDoc::writeRawStream: EOF reading stream");
+      break;
+    }
     outStr->printf("%c", c);  
   }
   str->reset();
commit 88dbd4df0998233939b4a51cedbfc65c58a315f9
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Oct 19 22:47:15 2014 +1030

    pdfdetach: fix crash when getPage() returns null
    
    Bug 85145

diff --git a/utils/pdfdetach.cc b/utils/pdfdetach.cc
index 4f67fd7..3bae3c0 100644
--- a/utils/pdfdetach.cc
+++ b/utils/pdfdetach.cc
@@ -163,6 +163,8 @@ int main(int argc, char *argv[]) {
   nPages = doc->getCatalog()->getNumPages();
   for (i = 0; i < nPages; ++i) {
     page = doc->getCatalog()->getPage(i + 1);
+    if (!page)
+      continue;
     annots = page->getAnnots();
     if (!annots)
       break;


More information about the poppler mailing list