Corrupted screenshots?

Nov 23, 2014 at 10:19 PM
Hi,

I'm Travis Evans, a staff member of http://www.ticalc.org/. For a while, I've been observing problems with certain animated screenshots people upload to ticalc.org 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):
http://www.ticalc.org/archives/files/ss/858/85809.gif
http://www.ticalc.org/archives/files/ss/843/84301.gif

But here's one that happens to be good:
http://www.ticalc.org/archives/files/ss/843/84300.gif

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.
Developer
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.

BuckeyeDude
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. :-) ticalc.org'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.