commit | 34005e3d3d373c0c36898cc55eae48a79c8238a1 | [log] [tgz] |
---|---|---|
author | Lucas CHOLLET <lucas.chollet@free.fr> | Mon Mar 03 15:06:40 2025 -0700 |
committer | Lucas CHOLLET <lucas.chollet@free.fr> | Tue Mar 04 15:13:19 2025 -0700 |
tree | 696553c3b083081a5d2cb59a8a71a4b57e1c9cfe | |
parent | 44f97f08d729fcc77ea5d08e02cd538523dd7157 [diff] |
Recover from errors in ancillary chunks As per the third edition of the spec, decoders should recover from errors in ancillary chunks. In section 13.1 Error handling [1]: > Anomalous situations other than syntax errors shall be treated as > follows: > 1. Encountering an unknown ancillary chunk is never an error. The > chunk can simply be ignored. More specifically, in this commit, if a chunk that is detected as ancillary, does not pass the `check_chunk_name()` function, only a _benign_ is issued, instead of an error. This allows libpng to fully decode images like [2] and [3]. It has been tested by passing them to both pngtest and Gnome's image viewer. Note that invalid-unknown-ancillary-after-IDAT.png could already be displayed but not fully decoded. [1] https://w3c.github.io/png/#13Decoders.Errors [2] https://github.com/web-platform-tests/wpt/blob/master/png/errors/support/invalid-unknown-ancillary.png [3] https://github.com/web-platform-tests/wpt/blob/master/png/errors/support/invalid-unknown-ancillary-after-IDAT.png