summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEarl Ou <shunhsingou@google.com>2012-10-24 13:09:39 +0800
committerEarl Ou <shunhsingou@google.com>2012-11-07 13:37:11 +0800
commit64bf9ee95443c1d14455cbdb05c392b3967e4756 (patch)
tree81e861f9fdc6f96162edd363260f8b08f1974a64
parentc8ea027b1c6644002a3f29c8f899db59dc22bb7a (diff)
downloadandroid_packages_apps_Snap-64bf9ee95443c1d14455cbdb05c392b3967e4756.zip
android_packages_apps_Snap-64bf9ee95443c1d14455cbdb05c392b3967e4756.tar.gz
android_packages_apps_Snap-64bf9ee95443c1d14455cbdb05c392b3967e4756.tar.bz2
Handle wrong thumbnail tag type
Change-Id: If41834f0aa86425a06aaede815f3e0c3cdd17fd9
-rw-r--r--gallerycommon/src/com/android/gallery3d/exif/ExifParser.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/exif/ExifParser.java b/gallerycommon/src/com/android/gallery3d/exif/ExifParser.java
index 36e3b44..a6bbda0 100644
--- a/gallerycommon/src/com/android/gallery3d/exif/ExifParser.java
+++ b/gallerycommon/src/com/android/gallery3d/exif/ExifParser.java
@@ -450,6 +450,12 @@ public class ExifParser {
*/
public int getCompressedImageSize() {
if (mJpegSizeTag == null) return 0;
+
+ // Some invalid image use short type tag
+ if (mJpegSizeTag.getDataType() == ExifTag.TYPE_UNSIGNED_SHORT) {
+ return mJpegSizeTag.getUnsignedShort(0);
+ }
+
// Cast unsigned int to int since the thumbnail is always smaller
// than the size of APP1 (65536)
return (int) mJpegSizeTag.getUnsignedLong(0);