37742976 - Catch bad gifs am: e0f247e399 am: 7c28ca34ec am: 22bbfd7360 am: 7a6b99a4a4 am: 6ea30b87b1 am: a072033ce4

am: 93d52cb5e2

Change-Id: I35c5b7ee69984e1c91c63c9cf78af9d1c0e0ab43
This commit is contained in:
Tom Taylor
2017-07-12 19:12:40 +00:00
committed by android-build-merger

View File

@@ -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