summaryrefslogtreecommitdiff
path: root/external/poppler/0001-ImageStream-getLine-fix-crash-on-broken-files.patch.1
blob: b459a0a0bef7dfa7ce8bf639ed640a1a85785de7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From f4136a6353162db249f63ddb0f20611622ab61b4 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Wed, 27 Feb 2019 19:43:22 +0100
Subject: [PATCH] ImageStream::getLine: fix crash on broken files

Fixes #728
---
 poppler/Stream.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index 33537b0e..a41435ab 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -496,6 +496,9 @@ unsigned char *ImageStream::getLine() {
   }
  
   int readChars = str->doGetChars(inputLineSize, inputLine);
+  if (unlikely(readChars == -1)) {
+      readChars = 0;
+  }
   for ( ; readChars < inputLineSize; readChars++) inputLine[readChars] = EOF;
   if (nBits == 1) {
     unsigned char *p = inputLine;
-- 
2.20.1