summaryrefslogtreecommitdiffstats
path: root/gallerycommon
diff options
context:
space:
mode:
authorlihai <lihai@codeaurora.org>2015-08-13 15:15:42 +0800
committerSteve Kondik <steve@cyngn.com>2016-09-26 04:49:42 -0700
commit8ef3d2e6be6ae9ee65935f4a834521d3f0e0eecc (patch)
tree9cdd0422b222e6d3d8f10725f4d2e33f989d0430 /gallerycommon
parent0272aebe047b48c8a0f7bb330bff6a059ce722cd (diff)
downloadandroid_packages_apps_Gallery2-8ef3d2e6be6ae9ee65935f4a834521d3f0e0eecc.tar.gz
android_packages_apps_Gallery2-8ef3d2e6be6ae9ee65935f4a834521d3f0e0eecc.tar.bz2
android_packages_apps_Gallery2-8ef3d2e6be6ae9ee65935f4a834521d3f0e0eecc.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);