Assert JpegIFByteCount is int

This commit is contained in:
Andrew Murray 2025-01-13 07:57:28 +11:00
parent 5ad98e7abb
commit 34762ded75

View File

@ -191,7 +191,10 @@ class ImageFile(Image.Image):
if thumbnail_offset is not None:
thumbnail_offset += getattr(self, "_exif_offset", 0)
self.fp.seek(thumbnail_offset)
data = self.fp.read(ifd.get(ExifTags.Base.JpegIFByteCount))
length = ifd.get(ExifTags.Base.JpegIFByteCount)
assert isinstance(length, int)
data = self.fp.read(length)
fp = io.BytesIO(data)
with Image.open(fp) as im: