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}:"

Check warning on line 2150 in src/PIL/TiffImagePlugin.py

View check run for this annotation

Codecov / codecov/patch

src/PIL/TiffImagePlugin.py#L2149-L2150

Added lines #L2149 - L2150 were not covered by tests
f" Tag ID {tag}"
f" Field Type {field_type}"
f" Field Size {field_size}"
f" Count {count}"

Check warning on line 2154 in src/PIL/TiffImagePlugin.py

View check run for this annotation

Codecov / codecov/patch

src/PIL/TiffImagePlugin.py#L2153-L2154

Added lines #L2153 - L2154 were not covered by tests
)
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.