randy408 / libspng

Simple, modern libpng alternative
https://libspng.org
BSD 2-Clause "Simplified" License
729 stars 71 forks source link

Standard conformance vs libpng compatibility #14

Open randy408 opened 5 years ago

randy408 commented 5 years ago

This is a meta-issue is for all libpng compatibility issues caused by strict conformance checks.

libspng is very strict with parsing PNG's, almost any deviation from the standard results in an error. This can cause issues because libpng's implementation is the de facto PNG standard which is a lot more loose with checks, it will issue warnings/skip invalid chunks as long as the image can be decoded.

libspng should be able to decode PNG's that aren't standard conformant but are decoded by libpng in most cases, this should be the default behavior with an option to reenable these checks if there is demand for it.

randy408 commented 4 years ago

Changes made for libpng compatibility so far:

randy408 commented 3 years ago

To improve libpng compatibility the default CRC action for ancillary chunks will be changed from SPNG_CRC_ERROR to SPNG_CRC_DISCARD.

  1. https://libspng.org/docs/context/#spng_crc_action
  2. https://github.com/glennrp/libpng/blob/v1.6.37/png.h#L1436

Related issues:

randy408 commented 3 years ago

Since v0.6.3 all corrupted ancillary chunks are silently discarded, this eliminates 99% of compatibility issues with existing images.