75a61b
From 55db66c69fd56826b8523710046deab1a8d14ba2 Mon Sep 17 00:00:00 2001
75a61b
From: Albert Astals Cid <aacid@kde.org>
75a61b
Date: Wed, 21 Jun 2017 00:55:20 +0200
75a61b
Subject: [PATCH] Fix crash in malformed documents
75a61b
75a61b
---
75a61b
 poppler/JBIG2Stream.cc | 2 +-
75a61b
 1 file changed, 1 insertion(+), 1 deletion(-)
75a61b
75a61b
diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
75a61b
index 4853588..d89108c 100644
75a61b
--- a/poppler/JBIG2Stream.cc
75a61b
+++ b/poppler/JBIG2Stream.cc
75a61b
@@ -868,6 +868,8 @@
75a61b
   oneByte = x0 == ((x1 - 1) & ~7);
75a61b
 
75a61b
   for (yy = y0; yy < y1; ++yy) {
75a61b
+    if (unlikely((y + yy >= h) || (y + yy < 0)))
75a61b
+      continue;
75a61b
 
75a61b
     // one byte per line -- need to mask both left and right side
75a61b
     if (oneByte) {