mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 01:16:16 +03:00
Merge pull request #7753 from radarhere/eps
This commit is contained in:
commit
9ad22fc96a
|
@ -437,3 +437,11 @@ def test_eof_before_bounding_box() -> None:
|
||||||
with pytest.raises(OSError):
|
with pytest.raises(OSError):
|
||||||
with Image.open("Tests/images/zero_bb_eof_before_boundingbox.eps"):
|
with Image.open("Tests/images/zero_bb_eof_before_boundingbox.eps"):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def test_invalid_data_after_eof() -> None:
|
||||||
|
with open("Tests/images/illuCS6_preview.eps", "rb") as f:
|
||||||
|
img_bytes = io.BytesIO(f.read() + b"\r\n%" + (b" " * 255))
|
||||||
|
|
||||||
|
with Image.open(img_bytes) as img:
|
||||||
|
assert img.mode == "RGB"
|
||||||
|
|
|
@ -356,14 +356,10 @@ class EpsImageFile(ImageFile.ImageFile):
|
||||||
|
|
||||||
self._size = columns, rows
|
self._size = columns, rows
|
||||||
return
|
return
|
||||||
|
elif bytes_mv[:5] == b"%%EOF":
|
||||||
|
break
|
||||||
elif trailer_reached and reading_trailer_comments:
|
elif trailer_reached and reading_trailer_comments:
|
||||||
# Load EPS trailer
|
# Load EPS trailer
|
||||||
|
|
||||||
# if this line starts with "%%EOF",
|
|
||||||
# then we've reached the end of the file
|
|
||||||
if bytes_mv[:5] == b"%%EOF":
|
|
||||||
break
|
|
||||||
|
|
||||||
s = str(bytes_mv[:bytes_read], "latin-1")
|
s = str(bytes_mv[:bytes_read], "latin-1")
|
||||||
_read_comment(s)
|
_read_comment(s)
|
||||||
elif bytes_mv[:9] == b"%%Trailer":
|
elif bytes_mv[:9] == b"%%Trailer":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user