mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-24 00:04:09 +03:00
Break if the bit depth or mode id are unknown
This commit is contained in:
parent
56e4ad0dea
commit
f3fe22d2f2
|
@ -320,21 +320,26 @@ class EpsImageFile(ImageFile.ImageFile):
|
||||||
# binary/ascii (1: binary, 2: ascii)
|
# binary/ascii (1: binary, 2: ascii)
|
||||||
# data start identifier (the image data follows after a single line
|
# data start identifier (the image data follows after a single line
|
||||||
# consisting only of this quoted value)
|
# consisting only of this quoted value)
|
||||||
|
if imagedata_size:
|
||||||
|
bytes_read = 0
|
||||||
|
continue
|
||||||
|
|
||||||
image_data_values = byte_arr[11:bytes_read].split(None, 7)
|
image_data_values = byte_arr[11:bytes_read].split(None, 7)
|
||||||
columns, rows, bit_depth, mode_id = (
|
columns, rows, bit_depth, mode_id = (
|
||||||
int(value) for value in image_data_values[:4]
|
int(value) for value in image_data_values[:4]
|
||||||
)
|
)
|
||||||
|
|
||||||
if not imagedata_size:
|
if bit_depth == 1:
|
||||||
imagedata_size = columns, rows
|
self._mode = "1"
|
||||||
|
elif bit_depth == 8:
|
||||||
|
try:
|
||||||
|
self._mode = self.mode_map[mode_id]
|
||||||
|
except ValueError:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
if bit_depth == 1:
|
imagedata_size = columns, rows
|
||||||
self._mode = "1"
|
|
||||||
elif bit_depth == 8:
|
|
||||||
try:
|
|
||||||
self._mode = self.mode_map[mode_id]
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
elif bytes_mv[:5] == b"%%EOF":
|
elif bytes_mv[:5] == b"%%EOF":
|
||||||
break
|
break
|
||||||
elif trailer_reached and reading_trailer_comments:
|
elif trailer_reached and reading_trailer_comments:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user