GIF preview corruption

Found an issue with the phpBB system here at NESdev? Use this forum to report problems.

Moderator: Moderators

Post Reply
User avatar
rainwarrior
Posts: 7675
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

GIF preview corruption

Post by rainwarrior » Wed Sep 21, 2016 10:22 pm

In this thread corruption of preview GIFs was discussed: https://forums.nesdev.com/viewtopic.php ... 13#p179813

Details in that thread, but the problem seems to be that traditionally "optimized" GIFs (with each frame cropped to just the area that is different from the frame before) get severely corrupted by the resizing process.

Koitsu suggested that phpBB uses ImageMagick to do the resizing? If so, it seems that it has a "coalesce" option that needs to be applied before resizing, and probably an optimization flag as well to undo the file size explosion that coalesce will cause?

Might also be worth pointing out that the corrupted "preview" GIF in this example is actually 50% larger than the original one, which defeats part of the purpose of doing previews in the first place. I expect that more properly processing them might help with this.

calima
Posts: 1017
Joined: Tue Oct 06, 2015 10:16 am

Re: GIF preview corruption

Post by calima » Thu Sep 22, 2016 6:39 am

FWIW, I use gifsicle for all my gif needs. Its abilities go far above imagemagick's.

User avatar
koitsu
Posts: 4216
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: GIF preview corruption

Post by koitsu » Thu Sep 22, 2016 4:33 pm

calima wrote:FWIW, I use gifsicle for all my gif needs. Its abilities go far above imagemagick's.
Does phpBB have native support for this? If not, then (respectfully of course), it's an irrelevant point. PHP doesn't necessarily just call a shell utility to do its conversion (I'd be very surprised, and scared, if it did), it almost certainly uses the ImageMagick module, which relies on the actual C-based ImageMagick libraries.

tepples
Posts: 21751
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: GIF preview corruption

Post by tepples » Thu Sep 22, 2016 5:49 pm

MediaWiki uses the shell for thumbnails. Is that likewise scary?

User avatar
koitsu
Posts: 4216
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: GIF preview corruption

Post by koitsu » Thu Sep 22, 2016 6:18 pm

tepples wrote:MediaWiki uses the shell for thumbnails. Is that likewise scary?
Very, especially when you consider that an attack against whatever in mediawiki does thumbnail generation could effectively induce an out-of-process (e.g. fork bomb) scenario on a webserver. fork/exec are very expensive.

Post Reply