summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2018-01-10 23:24:19 +0100
committerAlbert Astals Cid <aacid@kde.org>2018-01-10 23:26:13 +0100
commita59f61641fcb36859b625749afb4561557e419f6 (patch)
tree62f5cf63e2dd0eea0cb739716f922d7b89701e5b
parent00c1566e8cc0dacd899ec6dd267265f4b714eae4 (diff)
PDFDoc::setup: Fail early if base stream length is 0
Bug #103552
-rw-r--r--poppler/PDFDoc.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 8fca2020..8aefc0b1 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005, 2006, 2008 Brad Hards <bradh@frogmouth.net>
-// Copyright (C) 2005, 2007-2009, 2011-2017 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2005, 2007-2009, 2011-2018 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2008 Julien Rebetez <julienr@svn.gnome.org>
// Copyright (C) 2008, 2010 Pino Toscano <pino@kde.org>
// Copyright (C) 2008, 2010, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
@@ -251,6 +251,13 @@ PDFDoc::PDFDoc(BaseStream *strA, GooString *ownerPassword,
GBool PDFDoc::setup(GooString *ownerPassword, GooString *userPassword) {
pdfdocLocker();
+
+ if (str->getLength() <= 0)
+ {
+ error(errSyntaxError, -1, "Document stream is empty");
+ return gFalse;
+ }
+
str->setPos(0, -1);
if (str->getPos() < 0)
{