Fresco: Crash for GIF with different frame sizes out of image boundaries

Created on 9 Feb 2017  路  11Comments  路  Source: facebook/fresco

When I play a gif with the url "http://stcbeta.zjol.com.cn/g1/M001C55CggRGlib1AqAeVBbAAAoz8pj_YU378.gif"
there throw exception java.lang.IllegalStateException: Width or height is too small.

log:
02-09 14:55:23.556 18793-20099/com.zhejiangdaily A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: JNI MonitorEnter called with pending exception java.lang.IllegalStateException: Width or height is too small
02-09 14:55:23.556 18793-20099/com.zhejiangdaily A/art: art/runtime/java_vm_ext.cc:410] at void com.facebook.animated.gif.GifFrame.nativeRenderFrame(int, int, android.graphics.Bitmap) (GifFrame.java:-2)
02-09 14:55:23.556 18793-20099/com.zhejiangdaily A/art: art/runtime/java_vm_ext.cc:410] at void com.facebook.animated.gif.GifFrame.renderFrame(int, int, android.graphics.Bitmap) (GifFrame.java:52)
02-09 14:55:23.556 18793-20099/com.zhejiangdaily A/art: art/runtime/java_vm_ext.cc:410] at void com.facebook.imagepipeline.animated.impl.AnimatedDrawableBackendImpl.renderImageDoesNotSupportScaling(android.graphics.Canvas, com.facebook.imagepipeline.animated.base.AnimatedImageFrame) (AnimatedDrawableBackendImpl.java:223)
02-09 14:55:23.556 18793-20099/com.zhejiangdaily A/art: art/runtime/java_vm_ext.cc:410] at void com.facebook.imagepipeline.animated.impl.AnimatedDrawableBackendImpl.renderFrame(int, android.graphics.Canvas) (AnimatedDrawableBackendImpl.java:181)

the fresco version 1.0.1
Why does it happen and How can I fix this bug?

bug starter-task

Most helpful comment

Fixed in 504401041cc783c231feb7fabc870a3acea3ee30

All 11 comments

The image doesn't work for me. I suppose the GIF is malformed?

I'm sorry, I got you an intranet url.
Could you try this url:
http://wx1.sinaimg.cn/large/483b6ae1gy1fckhyiypfhg20k00b974a.gif.

Thank you verry much! @oprisnik

Thanks for providing the GIF image! That's super helpful, as it shows that its frames are of different sizes. Especially interesting, is that one dimension is larger in the second frame than in the previous one. My guess is that something goes wrong due to that.

$ identify given.gif
t.gif[0] GIF 720x405 720x405+0+0 8-bit sRGB 2c 10.4KB 0.000u 0:00.000
t.gif[1] GIF 600x600 720x405+500+150 8-bit sRGB 256c 10.4KB 0.000u 0:00.000
t.gif[2] GIF 268x356 720x405+670+309 8-bit sRGB 256c 10.4KB 0.000u 0:00.000

For a workaround, I'd recommend that you re-transcode that GIF to have all drawing frames within the outer borders. I was able to reproduce this and I'll mark this as a bug.

CC: @oprisnik

hi,lambdapioneer.Thanks for your reply! I have removed the gif with different frame sizes.I hope to fix the bug early,at least not to crash.

@lambdapioneer hi, how about this issue now?

@lambdapioneer hi, how about this issue now?

Hi @wo327808864 and @shewim, thanks for the ping. Even though the GIF image might be a special case (not sure if it is within the standard), I think it's reasonable to expect that it does not crash the application. I'll make sure we look into this.

Also, we are always happy to accept pull-requests and this here is a good starter task.

Hi! I have same issue. How can I handle this case?

Fixed in 504401041cc783c231feb7fabc870a3acea3ee30

Thank you @RomanTruba for fixing this. This will go out with the next release of Fresco.

@RomanTruba Thanks for your fixes

Was this page helpful?
0 / 5 - 0 ratings