Closed gabe-sherman closed 3 weeks ago
To be simplistic, you have provided a file you say is malformed, and Pillow has raised an error. It's not clear to me how you expect Pillow to behave in this situation?
The "Expected ASCII value, found binary" error was removed in https://github.com/python-pillow/Pillow/pull/5121#discussion_r819240969
Thanks for the response! I definitely see where you're coming from. I wanted to report this in case this exception was occurring in an unexpected way where the data was being mishandled. As you said, this is expected behavior for handling data formed in this way, so there's not really anything to fix here :).
A ValueError occurs in the below code when provided with a malformed input. This occurs at line 119 in PpmImagePlugin.py when a token returned from _read_token is cast to an int.
Version
11.0.0
POC File
https://github.com/FuturesLab/POC/blob/main/pillow/poc-01
How to trigger
file.py poc-01
Trace Report
Potential Regression
This error also seems to be a regression, where a ValueError with a descriptive message is intentionally raised in version 9.0.0: