From 1e3f3ab5963aca613e27c8d2d46f68c89fc78a09 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Thu, 29 Dec 2022 21:52:09 +1100 Subject: [PATCH] Do not attempt to read IFD1 if absent --- src/PIL/Image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 0a79b1237..f7b1ebd9f 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -3687,7 +3687,7 @@ class Exif(MutableMapping): def get_ifd(self, tag): if tag not in self._ifds: if tag == ExifTags.IFD.IFD1: - if self._info is not None: + if self._info is not None and self._info.next != 0: self._ifds[tag] = self._get_ifd_dict(self._info.next) elif tag in [ExifTags.IFD.Exif, ExifTags.IFD.GPSInfo]: offset = self._hidden_data.get(tag, self.get(tag))