From 11fe965b923ce94f64c456134141394d3f8cb63c Mon Sep 17 00:00:00 2001 From: qqzhou Date: Tue, 10 Sep 2013 18:02:55 +0800 Subject: Gallery2: fix issue in readTag when parse Exif When read some Tag of jpeg images,the offset is less than the IFD0 offset position,then try to copy data above IFD0 as Tag value no matter whether data exists above IFD0,so null exception occurs in System.arraycopy.This issue can effect user in two aspects: 1.black thumbnail for some jpeg images in ALbumSetPage and ALbumPage. 2.force close happens when get details of some jpeg images. We set offset for this Tag not value on above situation. Change-Id: Icd368afcbed80556de0940e562dbcca42c53c849 CRs-Fixed: 525081 --- gallerycommon/src/com/android/gallery3d/exif/ExifParser.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gallerycommon/src/com/android/gallery3d/exif/ExifParser.java b/gallerycommon/src/com/android/gallery3d/exif/ExifParser.java index 5467d423d..5621c2339 100644 --- a/gallerycommon/src/com/android/gallery3d/exif/ExifParser.java +++ b/gallerycommon/src/com/android/gallery3d/exif/ExifParser.java @@ -556,7 +556,8 @@ class ExifParser { } // Some invalid images put some undefined data before IFD0. // Read the data here. - if ((offset < mIfd0Position) && (dataFormat == ExifTag.TYPE_UNDEFINED)) { + if ((offset < mIfd0Position) && (dataFormat == ExifTag.TYPE_UNDEFINED) + && (mIfd0Position > DEFAULT_IFD0_OFFSET)) { byte[] buf = new byte[(int) numOfComp]; System.arraycopy(mDataAboveIfd0, (int) offset - DEFAULT_IFD0_OFFSET, buf, 0, (int) numOfComp); -- cgit v1.2.3