diff options
| author | Earl Ou <shunhsingou@google.com> | 2012-08-08 15:19:13 +0800 |
|---|---|---|
| committer | Earl Ou <shunhsingou@google.com> | 2012-08-08 15:19:13 +0800 |
| commit | 0ee84c4254d16b584e6f3bf11d6c658631c349c0 (patch) | |
| tree | c377c40ea6abf68c7769ee55f8c39d5a6948fdae /src | |
| parent | 755388cd2caf8c537fb71cb833a606596854d65a (diff) | |
| download | android_packages_apps_Gallery2-0ee84c4254d16b584e6f3bf11d6c658631c349c0.tar.gz android_packages_apps_Gallery2-0ee84c4254d16b584e6f3bf11d6c658631c349c0.tar.bz2 android_packages_apps_Gallery2-0ee84c4254d16b584e6f3bf11d6c658631c349c0.zip | |
Handle error when string length=0 in IfdParser
Change-Id: I3a51e85060f3acd5026555e5f8d21f8cb2e0641e
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/gallery3d/exif/IfdParser.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/exif/IfdParser.java b/src/com/android/gallery3d/exif/IfdParser.java index b0b0bce10..0d1059cb0 100644 --- a/src/com/android/gallery3d/exif/IfdParser.java +++ b/src/com/android/gallery3d/exif/IfdParser.java @@ -125,9 +125,13 @@ public class IfdParser { } public String readString(int n) throws IOException { - byte[] buf = new byte[n]; - mTiffStream.readOrThrow(buf); - return new String(buf, 0, n - 1, "UTF8"); + if (n > 0) { + byte[] buf = new byte[n]; + mTiffStream.readOrThrow(buf); + return new String(buf, 0, n - 1, "UTF8"); + } else { + return ""; + } } public String readString(int n, Charset charset) throws IOException { |
