summaryrefslogtreecommitdiffstats
path: root/gallerycommon
diff options
context:
space:
mode:
authorlihai <lihai@codeaurora.org>2015-08-13 15:15:42 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2015-10-11 23:44:56 -0700
commitb3b18e8032a994ad9ad7817cc3528a7972e09804 (patch)
treeebb6cff3f321d6919ad10ad0246a7986b459de6b /gallerycommon
parent3a11c7e55b938257701dd87e68aa1c1ff341074a (diff)
downloadandroid_packages_apps_Gallery2-b3b18e8032a994ad9ad7817cc3528a7972e09804.tar.gz
android_packages_apps_Gallery2-b3b18e8032a994ad9ad7817cc3528a7972e09804.tar.bz2
android_packages_apps_Gallery2-b3b18e8032a994ad9ad7817cc3528a7972e09804.zip
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: Idc5537f751638f691822f6fe5300a486529e263f CRs-Fixed: 887654
Diffstat (limited to 'gallerycommon')
-rw-r--r--gallerycommon/src/com/android/gallery3d/exif/ExifParser.java3
1 files changed, 2 insertions, 1 deletions
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);