Re: Why is it that png files are not dependable over the long haul
Cosmin Truta <[email protected]> Sun, 5 Aug 2018 23:36:35 -0400
| Newsgroups | gmane.comp.graphics.png.devel |
|---|---|
| Message-ID | <CAAoVtZy5N_F0xoPULvZrEpSMa-zXRNXNH+3eHnCLP4q7nDCUcw@mail.gmail.com> |
On Thu, 2 Aug 2018 at 02:37, J Decker wrote:
> Experimenting with the chromium modified zlib, I found a flag INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
That's in the original zlib, also. But you don't need it.
What you need is the following libpng function call:
png_set_option(png_ptr,
PNG_MAXIMUM_INFLATE_WINDOW,
PNG_OPTION_ON);
See the libpng manual for details.
To conclude the story from my previous email:
If PNG_MAXIMUM_INFLATE_WINDOW is set to PNG_OPTION_OFF (i.e. the
default), libpng can diagnose the error, but not recover from it.
Conversely, if PNG_MAXIMUM_INFLATE_WINDOW is set to PNG_OPTION_ON,
libpng can decode the image, but not know that the image had an error.
It's an either/or proposition, unfortunately.
Sincerely,
Cosmin
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot