Skip to content

Handle multiple and malformed JPEG APP13 markers#4370

Merged
homm merged 5 commits intopython-pillow:masterfrom
uploadcare:jpeg-multiple-app13
Jan 27, 2020
Merged

Handle multiple and malformed JPEG APP13 markers#4370
homm merged 5 commits intopython-pillow:masterfrom
uploadcare:jpeg-multiple-app13

Conversation

@homm
Copy link
Copy Markdown
Member

@homm homm commented Jan 19, 2020

This is a regression compared to Pillow 5.3, where the APP13 marker was not analyzing and images were opening without errors.

I met JPEGs with two APP13 markers were the first APP13 is always 65504 bytes length and looks like the second is just a continuation.

One of them: https://user-images.githubusercontent.com/128982/72672639-0a30b800-3a6e-11ea-88c2-d2b8fa8ca623.jpeg

This fix does not join markers since I don't know is it applicable for all files. Instead, it does not fail on the reading errors and collects data from all successfully processed markers.

@homm homm requested a review from radarhere January 19, 2020 00:54
@radarhere
Copy link
Copy Markdown
Member

radarhere commented Jan 20, 2020

Is the image that you've linked to one that can be included as a test image under the Pillow license?

@homm
Copy link
Copy Markdown
Member Author

homm commented Jan 20, 2020

Probably no. I'll prepare another image with the same chunks.

@homm homm removed the Needs Tests label Jan 20, 2020
@homm
Copy link
Copy Markdown
Member Author

homm commented Jan 20, 2020

@radarhere Test added

Comment thread src/PIL/JpegImagePlugin.py Outdated
Co-Authored-By: Andrew Murray <3112309+radarhere@users.noreply.github.com>
@homm homm merged commit 5965437 into python-pillow:master Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants