Bug 241839 - GIFImageDecoder: Can't render some corrupted GIF images of the 88x31 GIF Collection
Summary: GIFImageDecoder: Can't render some corrupted GIF images of the 88x31 GIF Coll...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fujii Hironori
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-06-21 22:21 PDT by Fujii Hironori
Modified: 2022-06-23 17:51 PDT (History)
3 users (show)

See Also:


Attachments
WIP patch (1.42 KB, patch)
2022-06-22 00:01 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
Patch (3.89 KB, patch)
2022-06-22 01:01 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fujii Hironori 2022-06-21 22:21:10 PDT
GIFImageDecoder: Can't render some corrupted GIF images of the 88x31 GIF Collection

Non-cocoa ports are uing GIFImageDecoder.
It can't render some images of https://cyber.dabamos.de/88x31/ , but Safari, Chrome and Firefox can.

For example,

https://cyber.dabamos.de/88x31/besteyes2.gif
https://cyber.dabamos.de/88x31/epicenter.gif
https://cyber.dabamos.de/88x31/filetransit.gif


GIFImageReader.cpp determines they are corrupted in the following condition.
`*currentComponent` was 0.

https://github.com/WebKit/WebKit/blob/49c1b53f803fe6952e293bfde206b22dc4ceadef/Source/WebCore/platform/image-decoders/gif/GIFImageReader.cpp#L502-L508

>             // If we get anything other than ',' (image separator), '!'
>             // (extension), or ';' (trailer), there is extraneous data
>             // between blocks. The GIF87a spec tells us to keep reading
>             // until we find an image separator, but GIF89a says such
>             // a file is corrupt. We follow GIF89a and bail out.
>             if (*currentComponent != ',')
>                 return false;

10635@main added the code.
Comment 1 Fujii Hironori 2022-06-21 22:35:43 PDT
These GIF contain the following comments:

> http://www.rtlsoft.com/animagic Created with Animagic GIF V 0.93 by Right to Left Software Inc. 
> http://www.rtlsoft.com/animagic Created with Animagic GIF V 1.02a by Right to Left Software Inc 
> http://www.rtlsoft.com/animagic Created with Animagic GIF V 1.05a by Right to Left Software Inc.  To suppress this message in the registered version uncheck "Options | Animagic comment frame"
Comment 2 Fujii Hironori 2022-06-21 23:30:22 PDT
Chromium's change.

242957 - Be more tolerant about corrupted GIF files - chromium
https://bugs.chromium.org/p/chromium/issues/detail?id=242957

Issue 15914009: More tolerant about malformed GIF files - Code Review
https://codereview.chromium.org/15914009
Comment 3 Fujii Hironori 2022-06-22 00:01:25 PDT
Created attachment 460405 [details]
WIP patch
Comment 4 Fujii Hironori 2022-06-22 01:01:10 PDT
Created attachment 460410 [details]
Patch
Comment 5 Fujii Hironori 2022-06-22 01:10:27 PDT
Pull request: https://github.com/WebKit/WebKit/pull/1678
Comment 6 Darin Adler 2022-06-22 09:27:03 PDT
Comment on attachment 460410 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=460410&action=review

> COMMIT_MESSAGE:1
> +GIFImageReader: Be torrent about invalid GIF files without a trailer(;) 

torrent -> tolerant
Comment 7 EWS 2022-06-23 17:50:05 PDT
Committed 251813@main (9bdfe6d4600b): <https://commits.webkit.org/251813@main>

Reviewed commits have been landed. Closing PR #1678 and removing active labels.
Comment 8 Radar WebKit Bug Importer 2022-06-23 17:51:14 PDT
<rdar://problem/95820038>