summaryrefslogtreecommitdiff
path: root/poppler/JBIG2Stream.cc
diff options
context:
space:
mode:
Diffstat (limited to 'poppler/JBIG2Stream.cc')
-rw-r--r--poppler/JBIG2Stream.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 33241436..e2f8ec07 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -15,7 +15,7 @@
//
// Copyright (C) 2006 Raj Kumar <rkumar@archive.org>
// Copyright (C) 2006 Paul Walmsley <paul@booyaka.com>
-// Copyright (C) 2006-2010, 2012 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2010, 2012, 2014 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2009 David Benjamin <davidben@mit.edu>
// Copyright (C) 2011 Edward Jiang <ejiang@google.com>
// Copyright (C) 2012 William Bader <williambader@hotmail.com>
@@ -3499,8 +3499,9 @@ JBIG2Bitmap *JBIG2Stream::readGenericBitmap(GBool mmr, int w, int h,
if (atx[0] >= -8 && atx[0] <= 8) {
// set up the adaptive context
- if (y + aty[0] >= 0) {
- atP0 = bitmap->getDataPtr() + (y + aty[0]) * bitmap->getLineSize();
+ const int atY = y + aty[0];
+ if ((atY >= 0) && (atY < bitmap->getHeight())) {
+ atP0 = bitmap->getDataPtr() + atY * bitmap->getLineSize();
atBuf0 = *atP0++ << 8;
} else {
atP0 = NULL;