diff options
author | Tom Taylor <tomtaylor@google.com> | 2017-07-12 19:01:08 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-07-12 19:01:08 +0000 |
commit | 7c28ca34ececfcfe5a1246b7287382fb423bf538 (patch) | |
tree | 49e1204c324a715c89a1346dc9829571432b2b0f | |
parent | 0cf3a7d3ec86997f52f3ec5eaad8f26540c61e33 (diff) | |
parent | e0f247e3994869567288f8057d9e3afec1dd2fe6 (diff) | |
download | Messaging-7c28ca34ececfcfe5a1246b7287382fb423bf538.tar.gz |
37742976 - Catch bad gifs
am: e0f247e399
Change-Id: I54307fd0a08e1ecc14b2f3be5b8d52fac6ff7033
-rw-r--r-- | src/com/android/messaging/datamodel/media/GifImageResource.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/com/android/messaging/datamodel/media/GifImageResource.java b/src/com/android/messaging/datamodel/media/GifImageResource.java index d50cf47..6801165 100644 --- a/src/com/android/messaging/datamodel/media/GifImageResource.java +++ b/src/com/android/messaging/datamodel/media/GifImageResource.java @@ -23,6 +23,7 @@ import android.support.rastermill.FrameSequence; import android.support.rastermill.FrameSequenceDrawable; import com.android.messaging.util.Assert; +import com.android.messaging.util.LogUtil; import java.io.IOException; import java.io.InputStream; @@ -55,7 +56,14 @@ public class GifImageResource extends ImageResource { @Override public Drawable getDrawable(Resources resources) { - return new FrameSequenceDrawable(mFrameSequence); + try { + return new FrameSequenceDrawable(mFrameSequence); + } catch (final Exception e) { + // Malicious gif images can make platform throw different kind of exceptions. Catch + // them all. + LogUtil.e(LogUtil.BUGLE_TAG, "Error getting drawable for GIF", e); + return null; + } } @Override |