redwarp / gifdecoder

An implementation of a gif decoder written 100% in Kotlin, plus an associated Drawable for Android
Apache License 2.0
47 stars 6 forks source link

Max size gifs can't be decoded as it wont fit in memory. #26

Closed redwarp closed 1 year ago

redwarp commented 1 year ago

A theoritical max gif is 65535x65535, meaning 4_294_836_225 pixels. The code creates an array to store these pixels. But in java, the max size of an array is around Integer.MAX_VALUE (apparently depends on the VM, can be minus 2 or minus 8), so around 2_147_483_648. It means that the library is actually unable to decode gifs that size 🤔, and will throw an exception.

redwarp commented 1 year ago

It fails as expected, might still be nice to provide a better Exception