-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Provide a documented way to turn off EPS handling via Ghostscript #7391
Comments
Hi. See what you think of #7392. It adds |
Wow, that was fast! Not sure if I read the code exactly, but wouldn't this trigger OSError from line 72 whenever I set it to |
No, the Pillow/src/PIL/EpsImagePlugin.py Lines 383 to 386 in a84a435
With the workaround that you posted above, an EPS file won't be identified. In my suggestion, it will be identified. |
Ah sorry, I've mistaken |
Sure. I've added a commit to the PR. You can see the preview at https://pillow--7392.org.readthedocs.build/en/7392/handbook/image-file-formats.html#eps
|
Thank you <3 |
Pillow parses EPS files through ghostscript.
Ghostscript is troubled with regular security issues of critical impact, such as remote code execution. There has been this one, two CVEs this year already, and there is another one just coming up with the patch not yet included in any release.
We do not need EPS handling and we can turn it off in our code using
Image.open(…, formats=["JPG", "PNG", …])
. However, we use third-party components that also use Pillow (such asreportlab
) and we'd like to make sure they also don't accidentally open EPS files and we can't modify the code.From what I can tell, we can accomplish this with:
However, that seems to be undocumented and feels like unclean monkeypatching. I think it would be worth it providing a documented API to turn off third-party backends like ghostscript globally.
The text was updated successfully, but these errors were encountered: