Corrupted screenshots?

Nov 23, 2014 at 10:19 PM

I'm Travis Evans, a staff member of For a while, I've been observing problems with certain animated screenshots people upload to that appear to be generated by WabbitEmu. Not all of them are affected, but every now and then someone will upload one, and even though my browser can display it, giflib-4 (which our file-processing script uses) for some reason can't cope, so the screenshot gets dropped when the file is approved. Imagemagick also complains when using the 'identify -verbose' command that these images are corrupted, but it will work with other GIFs.

Here are a couple of examples of problematic images (which I've had to add manually):

But here's one that happens to be good:

I'm not sure what versions of Wabbit people are using, but this has been ongoing for a few years or so. I'm not sure whether the issue is with giflib or with Wabbit (I haven't had much luck finding a GIF format validator type of thing). However, the only GIFs I've encountered so far with this problem with have contained the string "Wabbit" in them, so this may be something we want to investigate.
Mar 19, 2015 at 9:46 AM
Hey Travis,

Sorry for the delay, this one took a while to track down. This bug has been around forever, and should also affect PTI, since we stole the GIF writing code from there. I've fixed this for the next release of Wabbit. Unfortunately however with the amount of time this bug has been around it's likely something that you'll see now and again.

Technical details of the fix:
The issue is that the background index into the global color table is bad, assuming that you output at the default shades. I'm not exactly sure when the background index color is used, normally it's for transparent colors but I wouldn't expect wabbit gifs to have any of these. Regardless, if it is ever referenced it pointed to the 15th color, which would be out of range of the highest number of shades in wabbit, and would only be used if the GIF had at least 9 shades. Even then the color would be undefined since colors out of range of the shades are not set, so it would probably be random garbage.

Mar 20, 2015 at 5:08 AM
Thanks a lot for the time and feedback! Yeah, it's too bad I didn't figure this out and report the bug a long time ago. :-)'s upload system doesn't even warn authors about bad screenshots currently; they just disappear, because validation happens on approve rather than upload. That could honestly be improved.