From: Glenn Randers-Pehrson Date: Wed, 2 Aug 2017 19:52:12 +0000 (-0400) Subject: Added "-define png:ignore-crc" option to PNG decoder X-Git-Tag: 7.0.6-5~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26b28d50a95dd2f943824bf9c47f7325e60b15e3;p=imagemagick Added "-define png:ignore-crc" option to PNG decoder --- diff --git a/ChangeLog b/ChangeLog index 96803ec81..d737da833 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,9 @@ https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=32418). * Fix improper use of NULL in the JNG decoder (CVE-2017-11750, Reference https://github.com/ImageMagick/ImageMagick/issues/632). + * Added "-define png:ignore-crc" option to PNG decoder. When you know + your image has no CRC or ADLER32 errors, this can speed up decoding. + It is also helpful in debugging bug reports from "fuzzers". 2017-07-29 7.0.6-5 Cristy * Off by one error for gradient coder (reference diff --git a/coders/png.c b/coders/png.c index e8e264f0e..f9bea7f4c 100644 --- a/coders/png.c +++ b/coders/png.c @@ -2428,6 +2428,19 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, const char *value; + value=GetImageOption(image_info,"png:ignore-crc"); + if (value != NULL) + { + /* Turn off CRC checking while reading */ + png_set_crc_action(ping, PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE); +#ifdef PNG_IGNORE_ADLER32 + /* Turn off ADLER32 checking while reading */ + png_set_option(ping, PNG_IGNORE_ADLER32, PNG_OPTION_ON); +#endif + } + + ping_preserve_iCCP=MagickTrue; + value=GetImageOption(image_info,"profile:skip"); if (IsOptionMember("ICC",value) == MagickFalse)