mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
Merge pull request #1622 from wiredfool/alt_pr_1493
Catch the IFD error near the source
This commit is contained in:
commit
6990bc514f
|
@ -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