YAL-GameMaker / sprite_add_gif

Load animated GIFs as sprites in GameMaker Studio 2.3+ games
6 stars 0 forks source link

The extension crashes when trying to add any of the animated emote gifs provided by Twitch servers. #1

Open LKoehlinger opened 2 years ago

LKoehlinger commented 2 years ago

An example file:

https://static-cdn.jtvnw.net/emoticons/v2/emotesv2_4b009a4695674a818d71d8894ac727a8/default/dark/1.0

The error thrown:

___________________________________________
############################################################################################
ERROR in
action number 1
of Async Event: HTTP
for object objTwitch:

index out of bounds request 0 maximum size is 0 ############################################################################################
gml_Script_anon_GifReader_gml_GlobalScript_GifHx_117446_GifReader_gml_GlobalScript_GifHx (line 377)
gml_Script_anon_GifReader_gml_GlobalScript_GifHx_109035_GifReader_gml_GlobalScript_GifHx (line 316)
gml_Script_anon_GifReader_gml_GlobalScript_GifHx_106244_GifReader_gml_GlobalScript_GifHx (line 297)
gml_Script_anon_GifReader_gml_GlobalScript_GifHx_89673_GifReader_gml_GlobalScript_GifHx (line 282)
gml_Script_anon_Gif_gml_GlobalScript_GifHx_23481_Gif_gml_GlobalScript_GifHx (line 56)
gml_Script_sprite_add_gif_buffer (line 130)
gml_Script_sprite_add_gif (line 189)
gml_Object_objTwitch_Other_62 (line 39)

It appears that within the GifReader readPixels function the _dict array is never populated before being read from. I was developing a twitch chat integration for gamemaker and all animated emotes would crash the project upon being imported with the sprite_add_gif function. The issue is easily reproducable by simply downloading the example gif file and importing it using the sample project.

YellowAfterlife commented 2 years ago

The good news are that your issue is reproducible.

The bad news are that your issue appears to be a bug with LZW decompressor in the Haxe library I use - you'll want to report it here; the sample code is as following for your GIF (tested on Neko VM)

import format.gif.Reader;
import sys.io.File;
class Main {
    static function main() {
        var i = File.read("test.gif");
        var g = new Reader(i);
        trace(g.read());
    }
}