mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 02:16:19 +03:00
Merge pull request #320 from ericbuehl/master
be more tolerant of tiff tag read failures
This commit is contained in:
commit
2974749f21
|
@ -47,6 +47,7 @@ from PIL import Image, ImageFile
|
||||||
from PIL import ImagePalette
|
from PIL import ImagePalette
|
||||||
from PIL import _binary
|
from PIL import _binary
|
||||||
|
|
||||||
|
import warnings
|
||||||
import array, sys
|
import array, sys
|
||||||
import collections
|
import collections
|
||||||
import itertools
|
import itertools
|
||||||
|
@ -398,7 +399,8 @@ class ImageFileDirectory(collections.MutableMapping):
|
||||||
data = ifd[8:8+size]
|
data = ifd[8:8+size]
|
||||||
|
|
||||||
if len(data) != size:
|
if len(data) != size:
|
||||||
raise IOError("not enough data")
|
warnings.warn("Possibly corrupt EXIF data. Expecting to read %d bytes but only got %d. Skipping tag %s" % (size, len(data), tag))
|
||||||
|
continue
|
||||||
|
|
||||||
self.tagdata[tag] = typ, data
|
self.tagdata[tag] = typ, data
|
||||||
self.tagtype[tag] = typ
|
self.tagtype[tag] = typ
|
||||||
|
|
Loading…
Reference in New Issue
Block a user