Raise ValueError if seeking to greater than offset-sized integer in TIFF by radarhere · Pull Request #7883 · python-pillow/Pillow

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.