godot-gif
godot-gif copied to clipboard
Plugin runs into infinite loop when loading certain gif with relatively large width and height.
Hello, I am experiencing a editor freeze problem when auto-importing a few gif that is relatively large in both filesize and image w/h dimensions.
I looked into the code a bit and add a few prints to pinpoint the culprit of the freeze.
The error message:
Running GIF to SpriteFrames Importer Running GIF to SpriteFrames Importer Running GIF to SpriteFrames Importer Running GIF to SpriteFrames Importer Image Width: 635 Image Width: 635 Image Width: 635 Image Width: 635 Image Height: 687 Image Height: 1325 Image Height: 900 Image Height: 689 Too many record attempts!100 ERROR: (null) at: godot::GifLoadTeoro: :mgainfy_ errercoorr d( sartct\eimmpatgse!_1f0r0a mes.cpp:56) ERROR: (null) at: godot::GifLoader::gif_error (src\image_frTaomoe sm.acnpyp :r5e6c)o rd attempts!100 ERROR: (null)
It seems the plugins function GifLoader::_load_frames is querying the info of gif header infinitely via DGifGetRecordType(gif, &recordType) function from dlib_gif libary. I added a counter to make it error out upon 100 attempts it seems to finally exits the infinite loop that caused editor freeze.
The failing gif, it's from docs from resonate plugin:
The modified source code based on master repo: src.zip
I am still new to gds extension stuff and not familiar with gif header struct or dlib_gif library, so hopefully someone will be able to pinpoint the problem causing the header check erratic behaviors.
Thanks.