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

IndexOutOfBoundsException when parseExifSegment #286

Closed
darklee opened this issue Dec 5, 2014 · 2 comments
Closed

IndexOutOfBoundsException when parseExifSegment #286

darklee opened this issue Dec 5, 2014 · 2 comments
Labels
Milestone

Comments

@darklee
Copy link

darklee commented Dec 5, 2014

java.lang.IndexOutOfBoundsException: index=6, limit=6, size of type=2
    at java.nio.Buffer.checkIndex(Buffer.java:165)
    at java.nio.HeapByteBuffer.getShort(HeapByteBuffer.java:203)
    at com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$RandomAccessReader.getInt16(ImageHeaderParser.java:315)
    at com.bumptech.glide.load.resource.bitmap.ImageHeaderParser.parseExifSegment(ImageHeaderParser.java:199)
    at com.bumptech.glide.load.resource.bitmap.ImageHeaderParser.getOrientation(ImageHeaderParser.java:140)
    at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:116)

Because of the exif data is only 6 bytes which equals to jpeg preamble.
1

Perhaps we can use the Throwable instead of IOException to ignore it.

try {
    orientation = new ImageHeaderParser(stream).getOrientation();
} catch (IOException Throwable e) {
    if (Log.isLoggable(TAG, Log.WARN)) {
        Log.w(TAG, "Cannot determine the image orientation from header", e);
    }
}
@sjudd
Copy link
Collaborator

sjudd commented Dec 6, 2014

Thanks for the report, any chance you're able to provide a test image?

@sjudd sjudd added the bug label Dec 6, 2014
@sjudd sjudd added this to the 3.5 milestone Dec 6, 2014
@darklee
Copy link
Author

darklee commented Dec 8, 2014

The test image

0040ec2fca0f0c3fa3f7019d60af6c46_280

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants