Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat most auxiliary chunk errors as benign.
This commit is based on what `png_handle_...` functions do in `libpng/pngrutil.c`: * Chunks appearing before IHDR are a fatal error. `png` crate already detects this in a single, centeralized location and reports `ChunkBeforeIhdr` error. * Chunks appearing after IDAT chunk, or duplicated chunks are treated as a benign error and ignored. Note that there are still some places where `png` crate is more strict. In some places this is unavoidable - e.g. the `SrgbRenderingIntent` enum can't represent values greater than 3 and the `Unit` enum can't represent values greater than 1. There are also some places where `png` crate is more permissive - e.g. in general `parse_...` functions don't complain if the chunk is longer than necessary.
- Loading branch information