Skip to content
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

Malformed APP1 EXIF segment are not ignored #7456

Closed
deepio opened this issue Oct 11, 2023 · 3 comments · Fixed by #7458
Closed

Malformed APP1 EXIF segment are not ignored #7456

deepio opened this issue Oct 11, 2023 · 3 comments · Fixed by #7458

Comments

@deepio
Copy link

deepio commented Oct 11, 2023

What did you do?

Tried to open an image from a Samsung device with malformed exif data. I can't control how the device will take pictures. I can open the image successfully in Paintbrush and other image manipulation tools, but not in Apple preview.

What did you expect to happen?

To ignore the segment and let me work with them pixels please.

What actually happened?

Traceback (most recent call last):
  File "/Users/deepio/Desktop/ape.py", line 7, in <module>
    image = Image.open(file)
  File "/Users/deepio/.pyenv/versions/3.10.4/lib/python3.10/site-packages/PIL/Image.py", line 3280, in open
    raise UnidentifiedImageError(msg)
PIL.UnidentifiedImageError: cannot identify image file 'bad_file.jpg'

What are your OS, Python and Pillow versions?

  • OS: ubuntu 22.04 and MacOS
  • Python: 3.10.4, 3.9, ...
  • Pillow: 10.0.1
from PIL import Image
file = "bad_file.jpg"

image = Image.open(file)

I tested to make sure that the scrubbed image still created the same issue and it does (bad_file2.jpg). I zipped the image just in-case github does some image manipulation on uploaded files, bad_file2.jpg is the same image with all white pixels and with the weird APP1 segment added.

bad_file2.zip

@radarhere
Copy link
Member

Is the image one that can be included in our test suite, and distributed under the Pillow license?

@deepio
Copy link
Author

deepio commented Oct 11, 2023

Yes, that's why I created the second image without personally identifiable information.

@radarhere
Copy link
Member

Thanks. I've created PR #7458 to resolve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants