PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, July 17, 2022

[FIXED] How to determine whether a GIF image contains a graphic control extension

 July 17, 2022     gif     No comments   

Issue

The 1990 CompuServe GIF89a specification defines a "graphic control extension" like so:

The Graphic Control Extension contains parameters used when processing a graphic rendering block. The scope of this extension is the first graphic rendering block to follow. The extension contains only one data sub-block.

This block is OPTIONAL; at most one Graphic Control Extension may precede a graphic rendering block. This is the only limit to the number of Graphic Control Extensions that may be contained in a Data Stream.

As this is block optional, how does one determine whether or not an arbitrary GIF image contains a graphics control extension?


Solution

As it turns out, the specification pretty plainly states that all extensions, including the Graphic Control, Plain Text, Comment, and Application extensions, are demarcated by the presence of a 0x21 at the start of the block.

What threw me off is that GIFs contain a flag located in the Logical Screen Descriptor that denotes the presence of an optional Global Color Table block, but there is no such flag to denote the presence of a graphic control extension (not sure why). It either comes right after the Logical Screen Descriptor or it doesn't. Hope this helps someone down the road...



Answered By - alex
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing