image-rs / image-png

PNG decoding and encoding library in pure Rust
https://docs.rs/png
Apache License 2.0
347 stars 139 forks source link

Ignore iCCP section if it is invalid #475

Closed nathaniel-daniel closed 3 months ago

nathaniel-daniel commented 4 months ago

This PR makes invalid iCCP sections get ignored instead of throwing an error. Let me know if I should add an option to toggle this behavior.

Ideally, I think the icc_profile field should be an Option<Result<_, _>>, but that would be breaking. To ensure duplicate iccp sections are handled correctly, I introduced a new have_iccp field.

fintelia commented 3 months ago

This might change if we switch to lazy loading of metadata chunks, but looks good to me