7c055c
From 8ad7b436649c424e22689a8a874c1b0cd7c1c0fc Mon Sep 17 00:00:00 2001
7c055c
From: Lumir Balhar <lbalhar@redhat.com>
7c055c
Date: Mon, 14 Jun 2021 09:22:45 +0200
7c055c
Subject: [PATCH 3/5] CVE-2021-28677
7c055c
7c055c
---
7c055c
 src/PIL/EpsImagePlugin.py | 8 ++++----
7c055c
 1 file changed, 4 insertions(+), 4 deletions(-)
7c055c
7c055c
diff --git a/src/PIL/EpsImagePlugin.py b/src/PIL/EpsImagePlugin.py
7c055c
index b503487..5f5af15 100644
7c055c
--- a/src/PIL/EpsImagePlugin.py
7c055c
+++ b/src/PIL/EpsImagePlugin.py
7c055c
@@ -167,12 +167,12 @@ class PSFile(object):
7c055c
         self.fp.seek(offset, whence)
7c055c
 
7c055c
     def readline(self):
7c055c
-        s = self.char or b""
7c055c
+        s = [self.char or b""]
7c055c
         self.char = None
7c055c
 
7c055c
         c = self.fp.read(1)
7c055c
-        while c not in b"\r\n":
7c055c
-            s = s + c
7c055c
+        while (c not in b"\r\n") and len(c):
7c055c
+            s.append(c)
7c055c
             c = self.fp.read(1)
7c055c
 
7c055c
         self.char = self.fp.read(1)
7c055c
@@ -180,7 +180,7 @@ class PSFile(object):
7c055c
         if self.char in b"\r\n":
7c055c
             self.char = None
7c055c
 
7c055c
-        return s.decode('latin-1')
7c055c
+        return b"".join(s).decode("latin-1")
7c055c
 
7c055c
 
7c055c
 def _accept(prefix):
7c055c
-- 
7c055c
2.31.1
7c055c