Fix decoding error with trailing comment extension blocks #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The GIF files that can be found on the Internet come in a wide variety of forms. Some strictly adhere to the original specification, others do not and differ in the actual sequence of blocks or their number.
For this reason, my decoder has a kind of "virtual" FrameBlock, which can contain all possible blocks in different order that occur in a GIF animation.
The TableBasedImage block, which is a chain of ImageDescriptor, (Local Color Table) and ImageData, is used as a feature for terminating a FrameBlock.
So far I have only seen GIF files that follow this scheme. However, there was one example where one (or more) comment extensions were added before the end. Here the decoding process failed.
This fix also adds "global comments" that are not part of my FrameBlock and are appended to the GifDataStream afterwards.