Handle duplicate EXIF header by jzakirov · Pull Request #8350 · python-pillow/Pillow
Fixes #8348
Changes proposed in this pull request:
- Explicitly check for double exif info and drop it
radarhere
changed the title
Handle dublicate exif header
Handle duplicate EXIF header
Comment on lines +3971 to +3973
| if data and data.startswith(b"Exif\x00\x00Exif\x00\x00"): | ||
| data = data[12:] | ||
| elif data and data.startswith(b"Exif\x00\x00"): |
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.
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
This image is uploaded by one of the clients
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters