1 |
From f4136a6353162db249f63ddb0f20611622ab61b4 Mon Sep 17 00:00:00 2001 |
2 |
From: Albert Astals Cid <aacid@kde.org> |
3 |
Date: Wed, 27 Feb 2019 19:43:22 +0100 |
4 |
Subject: [PATCH] ImageStream::getLine: fix crash on broken files |
5 |
|
6 |
Fixes #728 |
7 |
--- |
8 |
poppler/Stream.cc | 3 +++ |
9 |
1 file changed, 3 insertions(+) |
10 |
|
11 |
diff --git a/poppler/Stream.cc b/poppler/Stream.cc |
12 |
index 33537b0e..a41435ab 100644 |
13 |
--- a/poppler/Stream.cc |
14 |
+++ b/poppler/Stream.cc |
15 |
@@ -496,6 +496,9 @@ unsigned char *ImageStream::getLine() { |
16 |
} |
17 |
|
18 |
int readChars = str->doGetChars(inputLineSize, inputLine); |
19 |
+ if (unlikely(readChars == -1)) { |
20 |
+ readChars = 0; |
21 |
+ } |
22 |
for ( ; readChars < inputLineSize; readChars++) inputLine[readChars] = EOF; |
23 |
if (nBits == 1) { |
24 |
unsigned char *p = inputLine; |
25 |
-- |
26 |
2.18.1 |
27 |
|