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
SpiderImagePlugin: raise an error when seeking in a non-stack file #1794
Conversation
Using ImageSequence.Iterator on a non-stack SPIDER image leads to infinite loop. EOFError (which stops the iteration) is never raised because when the image isn't a stack, seek() returns gently without error.
Get an infinite loop as expected on latest Pillow 3.2.0 (Python 2.7 / OS X). Check completes with this patch. |
|
||
from PIL import Image, ImageSequence | ||
|
||
im = Image.open("images/hopper.spider") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please can you update this to "Tests/images/" so it can be run from the project root? That'll make it consistent with other checks/tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, done.
6f02d25
to
deb61a0
Compare
Thanks. I forgot earlier: is it possible to unit test this raise too? https://coveralls.io/builds/5638613/source?filename=PIL%2FSpiderImagePlugin.py#L176 |
I thought about that. Then I thought that if such a test failed, it would go into DOS, and that would be bad. I would have thought that was the idea behind separating the test into it's own file. |
If we're checking a non-stack file, we can just bail at 2 or more iterations of the same item. We could then incorporate that test into the normal test routine, since it wouldn't be a DOS. (though, I do appreciate not having a DOS automatically run in the testing suite either way) |
deb61a0
to
f3e5464
Compare
I realised that it is possible to write the additional test without running the risk of DOS. So I've updated the commit. |
We could fold thedos check into the main spider tests like this:
|
f3e5464
to
dabb68a
Compare
Thanks for the code. Done. I've removed the original separate dos file, let me know if you think it would be better to have both. |
Changes Unknown when pulling dabb68a on radarhere:spiderimageplugin into * on python-pillow:master*. |
Copy of PR #1741, with a test added.