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

Fix OOM when decoding large PNGs on API 23 and below. #372

Merged
merged 6 commits into from
Apr 26, 2020

Conversation

colinrtwhite
Copy link
Member

@colinrtwhite colinrtwhite commented Apr 26, 2020

Fixes: #368.

This fixes the OOM on API 23 and below. The crash was due to a difference in how BufferedInputStream increases its buffer size on Java 7 vs. Java 8.

We could fix this issue by making ExifInterfaceInputStream.available return a smaller value, however I decided to avoid EXIF data parsing entirely for PNG files. This is because EXIF data is very rarely used (especially for orientation) in PNGs and it would slow down every other PNG that doesn't have EXIF data as the decode can't short circuit when it finds the EXIF chunk.

@colinrtwhite colinrtwhite merged commit f019c8d into master Apr 26, 2020
@colinrtwhite colinrtwhite deleted the colin/exif_fix branch April 26, 2020 21:54
colinrtwhite added a commit that referenced this pull request Oct 5, 2022
* Fix OOM when decoding large PNGs on API 23 and below.

* Rename file.

* Temporarily disable fail-fast.

* Update tests.

* Upload larger HEIF file.

* Add large JPG test.
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.

OOM exception happening after upgrading to v0.10.0
1 participant