Skip to content

Commit 34762de

Browse files
committed
Assert JpegIFByteCount is int
1 parent 5ad98e7 commit 34762de

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/PIL/ImageFile.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,10 @@ def get_child_images(self) -> list[ImageFile]:
191191
if thumbnail_offset is not None:
192192
thumbnail_offset += getattr(self, "_exif_offset", 0)
193193
self.fp.seek(thumbnail_offset)
194-
data = self.fp.read(ifd.get(ExifTags.Base.JpegIFByteCount))
194+
195+
length = ifd.get(ExifTags.Base.JpegIFByteCount)
196+
assert isinstance(length, int)
197+
data = self.fp.read(length)
195198
fp = io.BytesIO(data)
196199

197200
with Image.open(fp) as im:

0 commit comments

Comments
 (0)