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 28, 2024
1 parent 1bf9fb4 commit b7248be
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 @@ -2146,17 +2146,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(

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

View check run for this annotation

Codecov / codecov/patch

src/PIL/TiffImagePlugin.py#L2156-L2157

Added lines #L2156 - L2157 were not covered by tests
count, isShort=(field_size == 2), isLong=(field_size == 4)
)
self.f.seek(cur_pos)
except RuntimeError as e:
msg = (

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

View check run for this annotation

Codecov / codecov/patch

src/PIL/TiffImagePlugin.py#L2160-L2162

Added lines #L2160 - L2162 were not covered by tests
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

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

View check run for this annotation

Codecov / codecov/patch

src/PIL/TiffImagePlugin.py#L2169

Added line #L2169 was not covered by tests

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

0 comments on commit b7248be

Please sign in to comment.