summaryrefslogtreecommitdiff
path: root/poppler/JBIG2Stream.cc
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2017-07-31 16:39:53 +0200
committerAlbert Astals Cid <aacid@kde.org>2017-07-31 16:39:53 +0200
commit66e718e753a527289ce86cd206fcffd23fc28d81 (patch)
treedc0c32b66c42fabc3553709e72d2b4ee9a8c1dcd /poppler/JBIG2Stream.cc
parent9cecd78ff12a145fd7a61d226d54fd8f9ce19638 (diff)
parent213ae24b4df97f557e771060e37197d0e57f6f7f (diff)
Merge remote-tracking branch 'origin/master' into better_object
Diffstat (limited to 'poppler/JBIG2Stream.cc')
-rw-r--r--poppler/JBIG2Stream.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index c6b86a50..50c6eee6 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -760,6 +760,10 @@ JBIG2Bitmap *JBIG2Bitmap::getSlice(Guint x, Guint y, Guint wA, Guint hA) {
JBIG2Bitmap *slice;
Guint xx, yy;
+ if (!data) {
+ return nullptr;
+ }
+
slice = new JBIG2Bitmap(0, wA, hA);
if (slice->isOk()) {
slice->clearToZero();
@@ -892,7 +896,7 @@ void JBIG2Bitmap::combine(JBIG2Bitmap *bitmap, int x, int y,
oneByte = x0 == ((x1 - 1) & ~7);
for (yy = y0; yy < y1; ++yy) {
- if (unlikely(y + yy) >= h)
+ if (unlikely((y + yy >= h) || (y + yy < 0)))
continue;
// one byte per line -- need to mask both left and right side
@@ -1303,7 +1307,7 @@ Goffset JBIG2Stream::getPos() {
int JBIG2Stream::getChars(int nChars, Guchar *buffer) {
int n, i;
- if (nChars <= 0) {
+ if (nChars <= 0 || !dataPtr) {
return 0;
}
if (dataEnd - dataPtr < nChars) {
@@ -3826,6 +3830,10 @@ JBIG2Bitmap *JBIG2Stream::readGenericRefinementRegion(int w, int h,
JBIG2BitmapPtr tpgrCXPtr2 = {0};
int x, y, pix;
+ if (!refBitmap) {
+ return nullptr;
+ }
+
bitmap = new JBIG2Bitmap(0, w, h);
if (!bitmap->isOk())
{