[libpng16] Cleaned up and corrected ICC profile handling.

contrib/libtests/makepng: corrected 'rgb' and 'gray' cases.  profile_error
    messages could be truncated; made a correct buffer size calculation and
    adjusted pngerror.c appropriately. png_icc_check_* checking improved;
    changed the functions to receive the correct color type of the PNG on read
    or write and check that it matches the color space of the profile (despite
    what the comments said before, there is danger in assuming the app will
    cope correctly with an RGB profile on a grayscale image and, since it
    violates the PNG spec, allowing it is certain to produce inconsistent
    app behavior and might even cause app crashes.) Check that profiles
    contain the tags needed to process the PNG (tags all required by the ICC
    spec). Removed unused PNG_STATIC from pngpriv.h.
This commit is contained in:
John Bowler
2012-08-25 16:21:46 -05:00
committed by Glenn Randers-Pehrson
parent 8010217201
commit 14d0ca620e
8 changed files with 185 additions and 45 deletions

View File

@@ -1424,7 +1424,8 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
* byte header.
*/
if (png_icc_check_header(png_ptr, &png_ptr->colorspace,
keyword, profile_length, profile_header))
keyword, profile_length, profile_header,
png_ptr->color_type))
{
/* Now read the tag table; a variable size buffer is
* needed at this point, allocate one for the whole