3587f3
From f4136a6353162db249f63ddb0f20611622ab61b4 Mon Sep 17 00:00:00 2001
3587f3
From: Albert Astals Cid <aacid@kde.org>
3587f3
Date: Wed, 27 Feb 2019 19:43:22 +0100
3587f3
Subject: [PATCH] ImageStream::getLine: fix crash on broken files
3587f3
3587f3
Fixes #728
3587f3
---
3587f3
 poppler/Stream.cc | 3 +++
3587f3
 1 file changed, 3 insertions(+)
3587f3
3587f3
diff --git a/poppler/Stream.cc b/poppler/Stream.cc
3587f3
index 33537b0e..a41435ab 100644
3587f3
--- a/poppler/Stream.cc
3587f3
+++ b/poppler/Stream.cc
3587f3
@@ -496,6 +496,9 @@ unsigned char *ImageStream::getLine() {
3587f3
   }
3587f3
  
3587f3
   int readChars = str->doGetChars(inputLineSize, inputLine);
3587f3
+  if (unlikely(readChars == -1)) {
3587f3
+      readChars = 0;
3587f3
+  }
3587f3
   for ( ; readChars < inputLineSize; readChars++) inputLine[readChars] = EOF;
3587f3
   if (nBits == 1) {
3587f3
     p = inputLine;
3587f3
-- 
3587f3
2.20.1
3587f3