Merge cherrypicks of [2686880, 2686702, 2686703, 2686704, 2686141, 2686142, 2686143, 2686705, 2686706, 2686707, 2686782, 2686783, 2686784, 2686785, 2686786, 2686787, 2686788, 2686708, 2686144, 2686789, 2686709, 2686710, 2686711, 2686712, 2686713, 2686714, 2686715] into oc-r4-release
Change-Id: I8d6f43ad28dd566b0701e365a3102cae9afb5e60
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.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 @@
@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