-
-
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
Handle duplicate EXIF header #8350
Conversation
src/PIL/Image.py
Outdated
if data and data.startswith(b"Exif\x00\x00Exif\x00\x00"): | ||
data = data[12:] | ||
elif data and data.startswith(b"Exif\x00\x00"): |
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.
if data and data.startswith(b"Exif\x00\x00Exif\x00\x00"): | |
data = data[12:] | |
elif data and data.startswith(b"Exif\x00\x00"): | |
while data and data.startswith(b"Exif\x00\x00"): |
This seems simpler to me.
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.
Done. Also added test for this problem as well
In the issue, you said
Are you sure that this is an image that can be distributed under the Pillow license? |
Good point. I'm not a lawyer, to be safe will manually create an image where the EXIF is broken same way. |
865a6c9
to
fad5e54
Compare
Co-authored-by: Jamil Zakirov <djamilzak@gmail.com>
fad5e54
to
23c461e
Compare
Fixes #8348
Changes proposed in this pull request: