[libpng15] Reject all iCCP chunks after the first,

even if the first one is invalid.
This commit is contained in:
Glenn Randers-Pehrson
2012-03-09 22:38:06 -06:00
parent fc9127370c
commit 0ff5150f91
4 changed files with 7 additions and 1 deletions

View File

@@ -1257,13 +1257,16 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* Should be an error, but we can cope with it */
png_warning(png_ptr, "Out of place iCCP chunk");
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP))
if ((png_ptr->mode & PNG_HAVE_iCCP) || (info_ptr != NULL &&
(info_ptr->valid & (PNG_INFO_iCCP|PNG_INFO_sRGB))))
{
png_warning(png_ptr, "Duplicate iCCP chunk");
png_crc_finish(png_ptr, length);
return;
}
png_ptr->mode |= PNG_HAVE_iCCP;
#ifdef PNG_MAX_MALLOC_64K
if (length > (png_uint_32)65535L)
{