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 failing to read EXIF data on pre-API 23. #331

Merged
merged 1 commit into from
Mar 29, 2020

Conversation

colinrtwhite
Copy link
Member

Figured this out while working on #330.

AlwaysAvailableInputStream returns Int.MAX_VALUE for available(). This seems to work fine on API 23+, but will cause an int overflow in BufferedInputStream.available(). Then when ExifInterface reads the stream it throws an EOFException because available is negative.

To fix this, we still use a really large number (1GB) that has no chance of overflowing.

This case is covered by tests in #330.

Fixes: #250

@colinrtwhite colinrtwhite changed the title Fix failing to read EXIF on pre-API 23. Fix failing to read EXIF data on pre-API 23. Mar 29, 2020
@colinrtwhite colinrtwhite merged commit de558a6 into master Mar 29, 2020
@colinrtwhite colinrtwhite deleted the colin/int_overflow branch March 29, 2020 20:15
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.

Exif rotation not applied for locally saved images/images taken with camera on some devices
1 participant