[poppler] poppler/CurlPDFDocBuilder.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Sep 14 23:08:31 UTC 2017


 poppler/CurlPDFDocBuilder.cc |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit 6d40d4bad46ce1b53624feca7410b35e4fe0048d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Sep 15 01:07:59 2017 +0200

    CurlPDFDocBuilder don't crash if given a url that doesn't exist

diff --git a/poppler/CurlPDFDocBuilder.cc b/poppler/CurlPDFDocBuilder.cc
index 91d4c307..03f5d801 100644
--- a/poppler/CurlPDFDocBuilder.cc
+++ b/poppler/CurlPDFDocBuilder.cc
@@ -15,6 +15,7 @@
 
 #include "CachedFile.h"
 #include "CurlCachedFile.h"
+#include "ErrorCodes.h"
 
 //------------------------------------------------------------------------
 // CurlPDFDocBuilder
@@ -27,6 +28,11 @@ CurlPDFDocBuilder::buildPDFDoc(const GooString &uri,
     CachedFile *cachedFile = new CachedFile(
         new CurlCachedFileLoader(), uri.copy());
 
+    if (cachedFile->getLength() == ((Guint) -1)) {
+        cachedFile->decRefCnt();
+        return PDFDoc::ErrorPDFDoc(errOpenFile, uri.copy());
+    }
+
     BaseStream *str = new CachedFileStream(
          cachedFile, 0, gFalse, cachedFile->getLength(), Object(objNull));
 


More information about the poppler mailing list