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