-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Indefinite loop while counting frames in truncated tiff image #5472
Comments
Thanks for reporting. Your file is telling Pillow that the next frame is in the same position as the current frame, leading to an infinite loop. I've created PR #5473 to resolve this - although my change doesn't raise an error like you are expecting, it just concludes that your image only has 1 frame. |
Thank you for such a quick solution. This seems to work when the last frame is corrupted. But when the image contains e.g. 4 frames and the third one is corrupted, |
Would you be able to attach that image? The information that is incorrect is the information telling us where the next image is, so I'm not sure if there is a way to figure that out without it. The specification states that "This file offset may |
Unfortunately I cannot shared this file, it is confidential. As I tried to create another one, I also wasn't able to open it in such a software. That leads me to outcome that |
Just to be clear, my change doesn't affect the |
Okay, your solution fits fine to our needs. Thank you! |
It's not clear to me - are you still interested in |
I am sorry for not being clear enough. I like the solution just with |
What did you do?
I tried to count number of frames in a tiff image. However, the image is corrupted.
What did you expect to happen?
I expected some kind of exception (OSError).
What actually happened?
Warning is logged
.../lib/python3.9/site-packages/PIL/TiffImagePlugin.py:793: UserWarning: Truncated File Read
and code is trapped inside indefinite for loop.
What are your OS, Python and Pillow versions?
also occurs in docker container with
truncated_img.tiff.zip
The text was updated successfully, but these errors were encountered: