Skip to content

Commit

Permalink
Merge pull request #6897 from radarhere/eps
Browse files Browse the repository at this point in the history
Stop reading when EPS line becomes too long
  • Loading branch information
hugovk authored Jan 18, 2023
2 parents 96a075b + 3360b5a commit 876b9f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/PIL/EpsImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,13 @@ def seek(self, offset, whence=io.SEEK_SET):
self.fp.seek(offset, whence)

def readline(self):
s = [self.char or b""]
self.char = None
s = []
if self.char:
s.append(self.char)
self.char = None

c = self.fp.read(1)
while (c not in b"\r\n") and len(c):
while (c not in b"\r\n") and len(c) and len(b"".join(s).strip(b"\r\n")) <= 255:
s.append(c)
c = self.fp.read(1)

Expand Down

0 comments on commit 876b9f4

Please sign in to comment.