Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise ValueError if seeking to greater than offset-sized integer in TIFF #7883

Merged
merged 1 commit into from Apr 1, 2024

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Mar 16, 2024

Resolves #7876

The issue provided an image that raises ValueError: cannot fit 'int' into an offset-sized integer when seeking to a large offset in a TIFF image.

This changes it to be ValueError: Unable to seek to frame instead.

I'm not highly convinced of the need for this change, but it at least documents in our code that this may happen.

Also, if the image is instead a BytesIO instance,

from PIL import Image
from io import BytesIO
with open("crash-3", "rb") as fp:
    im = Image.open(BytesIO(fp.read()))

Pillow currently raises OverflowError: Python int too large to convert to C ssize_t. This would also become a ValueError with this PR.

@radarhere radarhere added the TIFF label Mar 16, 2024
@hugovk hugovk merged commit da13358 into python-pillow:main Apr 1, 2024
57 checks passed
@radarhere radarhere deleted the tiff branch April 1, 2024 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uncaught Exception(s) in Pillow Library
2 participants