[libpng16] Control ADLER32 checking with new PNG_IGNORE_ADLER32 option.

This commit is contained in:
Glenn Randers-Pehrson
2016-12-24 16:12:20 -06:00
parent d65a92b951
commit dbb5fce3d8
6 changed files with 30 additions and 22 deletions

View File

@@ -418,10 +418,10 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
}
#if ZLIB_VERNUM >= 0x1281
/* Turn off validation of the ADLER32 checksum in IDAT chunks */
if ((png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) != 0 &&
png_ptr->zowner == png_IDAT)
#if ZLIB_VERNUM >= 0x1281 && \
defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
/* Turn off validation of the ADLER32 checksum in IDAT chunks */
ret = inflateValidate(&png_ptr->zstream, 0);
#endif
@@ -717,7 +717,7 @@ png_decompress_chunk(png_structrp png_ptr,
* the extra space may otherwise be used as a Trojan Horse.
*/
if (ret == Z_STREAM_END &&
chunklength - prefix_size != lzsize)
chunklength - prefix_size != lzsize)
png_chunk_benign_error(png_ptr, "extra compressed data");
}
@@ -827,7 +827,7 @@ png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size,
return Z_STREAM_ERROR;
}
}
#endif
#endif /* READ_iCCP */
/* Read and check the IDHR chunk */
@@ -4108,7 +4108,9 @@ png_read_IDAT_data(png_structrp png_ptr, png_bytep output,
png_zstream_error(png_ptr, ret);
if (output != NULL)
png_chunk_error(png_ptr, png_ptr->zstream.msg);
{
png_chunk_error(png_ptr, png_ptr->zstream.msg);
}
else /* checking */
{