mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Reject iCCP chunk after the first, even if the first one is invalid.
This commit is contained in:
@@ -1359,13 +1359,16 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
return;
|
||||
}
|
||||
|
||||
if (info_ptr != NULL && (info_ptr->valid & (PNG_INFO_iCCP|PNG_INFO_sRGB)))
|
||||
if ((png_ptr->mode & PNG_HAVE_iCCP) || (info_ptr != NULL &&
|
||||
(info_ptr->valid & (PNG_INFO_iCCP|PNG_INFO_sRGB))))
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
png_chunk_benign_error(png_ptr, "Duplicate color profile");
|
||||
return;
|
||||
}
|
||||
|
||||
png_ptr->mode |= PNG_HAVE_iCCP;
|
||||
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
/* TODO: read the chunk in pieces, validating it as we go. */
|
||||
png_ptr->chunkdata = png_voidcast(png_charp, png_malloc(png_ptr, length));
|
||||
|
||||
Reference in New Issue
Block a user