mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-03 19:33:07 +03:00
Catch the IFD error near the source
This commit is contained in:
parent
9ba3799980
commit
eba87ac6d9
|
@ -453,9 +453,12 @@ def _getmp(self):
|
||||||
head = file_contents.read(8)
|
head = file_contents.read(8)
|
||||||
endianness = '>' if head[:4] == b'\x4d\x4d\x00\x2a' else '<'
|
endianness = '>' if head[:4] == b'\x4d\x4d\x00\x2a' else '<'
|
||||||
# process dictionary
|
# process dictionary
|
||||||
info = TiffImagePlugin.ImageFileDirectory_v2(head)
|
try:
|
||||||
info.load(file_contents)
|
info = TiffImagePlugin.ImageFileDirectory_v2(head)
|
||||||
mp = dict(info)
|
info.load(file_contents)
|
||||||
|
mp = dict(info)
|
||||||
|
except:
|
||||||
|
raise SyntaxError("malformed MP Index (unreadable directory)")
|
||||||
# it's an error not to have a number of images
|
# it's an error not to have a number of images
|
||||||
try:
|
try:
|
||||||
quant = mp[0xB001]
|
quant = mp[0xB001]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user