Skip to content

Commit

Permalink
add more data to error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Yay295 committed Aug 19, 2024
1 parent 35a70e4 commit dc7470f
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/PIL/TiffImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2133,17 +2133,27 @@ def fixIFD(self) -> None:
if tag in self.Tags:
cur_pos = self.f.tell()

if is_local:
self.fixOffsets(
count, isShort=(field_size == 2), isLong=(field_size == 4)
)
self.f.seek(cur_pos + 4)
else:
self.f.seek(offset)
self.fixOffsets(
count, isShort=(field_size == 2), isLong=(field_size == 4)
try:
if is_local:
self.fixOffsets(
count, isShort=(field_size == 2), isLong=(field_size == 4)
)
self.f.seek(cur_pos + 4)
else:
self.f.seek(offset)
self.fixOffsets(
count, isShort=(field_size == 2), isLong=(field_size == 4)
)
self.f.seek(cur_pos)
except RuntimeError as e:
msg = (
f"{e}:"
f" Tag ID {tag}"
f" Field Type {field_type}"
f" Field Size {field_size}"
f" Count {count}"
)
self.f.seek(cur_pos)
raise RuntimeError(msg) from e

elif is_local:
# skip the locally stored value that is not an offset
Expand Down

0 comments on commit dc7470f

Please sign in to comment.