mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Stop reading when a line becomes too long
This commit is contained in:
parent
50f5eade47
commit
3360b5a756
|
@ -173,11 +173,13 @@ class PSFile:
|
|||
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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user