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
Incorrect behaviour of the ImageFile._safe_read function #5871
Comments
Why are you calling Is there a concrete problem when calling this via the public API? |
I didn't find a problem via the public API. I just found this function because it raised an exception for an incompatible / truncated image and noticed, that it does not always do what its docstring describes. I just thought it is worth reporting so there are no problems in the future (regarding that function). |
I've figured out a test case for this using our public APIs, and created #5872 accordingly. |
Merged, thanks both! |
What did you do?
Randomly came across the ImageFile._safe_read fuction.
What did you expect to happen?
An "OSError: Truncated File Read" if the length of the file-like object
fp
is less than the value of thesize
parameter.What actually happened?
Not always getting an OSError if the value for
size
is larger thanImageFile.SAFEBLOCK
(and the length of fp is less than size).What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: