--- poppler-0.26.5/poppler/Parser.cc
+++ poppler-0.26.5/poppler/Parser.cc
@@ -19,6 +19,7 @@
// Copyright (C) 2012 Hib Eris <hib@hiberis.nl>
// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
+// Copyright (C) 2018 Albert Astals Cid <aacid@kde.org>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -257,6 +258,12 @@ Stream *Parser::makeStream(Object *dict,
pos = pos - 1;
lexer->lookCharLastValueCached = Lexer::LOOK_VALUE_NOT_CACHED;
}
+ if (unlikely(length < 0)) {
+ return NULL;
+ }
+ if (unlikely(pos > LONG_LONG_MAX - length)) {
+ return NULL;
+ }
lexer->setPos(pos + length);
// refill token buffers and check for 'endstream'