[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

@@ -56,6 +56,7 @@ Version 1.5.10beta04 [March 10, 2012]
libpng-1.5.4. It sometimes produced too small of a window. libpng-1.5.4. It sometimes produced too small of a window.
Version 1.5.10beta05 [March 10, 2012] Version 1.5.10beta05 [March 10, 2012]
Reject all iCCP chunks after the first, even if the first one is invalid.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net: Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit (subscription required; visit

View File

@@ -3841,6 +3841,7 @@ Version 1.5.10beta04 [March 10, 2012]
libpng-1.5.4. It sometimes produced too small of a window. libpng-1.5.4. It sometimes produced too small of a window.
Version 1.5.10beta05 [March 10, 2012] Version 1.5.10beta05 [March 10, 2012]
Reject all iCCP chunks after the first, even if the first one is invalid.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@@ -466,6 +466,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
#define PNG_BACKGROUND_IS_GRAY 0x800 #define PNG_BACKGROUND_IS_GRAY 0x800
#define PNG_HAVE_PNG_SIGNATURE 0x1000 #define PNG_HAVE_PNG_SIGNATURE 0x1000
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */ #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
#define PNG_HAVE_iCCP 0x4000
/* Flags for the transformations the PNG library does on the image data */ /* Flags for the transformations the PNG library does on the image data */
#define PNG_BGR 0x0001 #define PNG_BGR 0x0001

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 */ /* Should be an error, but we can cope with it */
png_warning(png_ptr, "Out of place iCCP chunk"); 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_warning(png_ptr, "Duplicate iCCP chunk");
png_crc_finish(png_ptr, length); png_crc_finish(png_ptr, length);
return; return;
} }
png_ptr->mode |= PNG_HAVE_iCCP;
#ifdef PNG_MAX_MALLOC_64K #ifdef PNG_MAX_MALLOC_64K
if (length > (png_uint_32)65535L) if (length > (png_uint_32)65535L)
{ {