PluginGIF.cpp can segfault when reading a corrupt animated GIF using the GIF_PLAYBACK flag. There is a for loop in PluginGIF.cpp (v3.16.0 line 803) which copies pageline to scanline. When scanline is calculated, it is possible for "logicalheight - (y + info.top) - 1" to calculated -1. If anything < 0 is calculated, the four loop should break. This same scanline calculation is used during the much rarer GIF_DISPOSAL_BACKGROUND processing, and should be fixed there as well (v3.16.0 line 776). I've tested the attached code with an offending corrupt animated GIF, and it fixes the segfault.
Anonymous
Hi Aaron,
Thanks for the patchn it is now available in the CVS.
Hervé
Thank you for incorporating the fix, for the quick response, and as always for FreeImage!
fixed in release 3.17.0