From e95ce2c517162cfa7f2a40f0d80f85c803215d59 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Wed, 7 May 2014 12:07:12 -0500 Subject: [PATCH] [libpng16] Added PNG_SKIP_sRGB_CHECK_PROFILE choice for png_set_option(). --- ANNOUNCE | 5 +++-- CHANGES | 3 ++- libpng-manual.txt | 24 ++++++++++++++++-------- libpng.3 | 32 ++++++++++++++++++++------------ png.c | 11 +++++++++-- png.h | 13 +++++++------ 6 files changed, 57 insertions(+), 31 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index c6f3a512a..16dbd6fe0 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.6.11beta06 - April 26, 2014 +Libpng 1.6.11beta06 - May 7, 2014 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -61,7 +61,8 @@ Version 1.6.11beta05 [April 26, 2014] "Not recognizing known sRGB profile that has been edited" warning for ICC V2 profiles that lack the MD5 signature in the profile header. -Version 1.6.11beta06 [April 26, 2014] +Version 1.6.11beta06 [May 7, 2014] + Added PNG_SKIP_sRGB_CHECK_PROFILE choice for png_set_option(). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 341cee8c2..9b2f4c29e 100644 --- a/CHANGES +++ b/CHANGES @@ -4912,7 +4912,8 @@ Version 1.6.11beta05 [April 26, 2014] "Not recognizing known sRGB profile that has been edited" warning for ICC V2 profiles that lack the MD5 signature in the profile header. -Version 1.6.11beta06 [April 26, 2014] +Version 1.6.11beta06 [May 7, 2014] + Added PNG_SKIP_sRGB_CHECK_PROFILE choice for png_set_option(). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/libpng-manual.txt b/libpng-manual.txt index d3cf001bb..52a2c2328 100644 --- a/libpng-manual.txt +++ b/libpng-manual.txt @@ -1,6 +1,6 @@ libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.11beta06 - April 26, 2014 + libpng version 1.6.11beta06 - May 7, 2014 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson @@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.6.11beta06 - April 26, 2014 + libpng versions 0.97, January 1998, through 1.6.11beta06 - May 7, 2014 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson @@ -5038,11 +5038,19 @@ Error detection in some chunks has improved; in particular the iCCP chunk reader now does pretty complete validation of the basic format. Some bad profiles that were previously accepted are now accepted with a warning or rejected, depending upon the png_set_benign_errors() setting, in particular the -very old broken Microsoft/HP 3144-byte sRGB profile. The PNG spec requirement -that only grayscale profiles may appear in images with color type 0 or 4 and -that even if the image only contains gray pixels, only RGB profiles may appear -in images with color type 2, 3, or 6, is now enforced. The sRGB chunk -is allowed to appear in images with any color type. +very old broken Microsoft/HP 3144-byte sRGB profile. Starting with +libpng-1.6.11, recognizing and checking sRGB profiles can be avoided by +means of + + png_set_option(ping, PNG_SKIP_sRGB_CHECK_PROFILE, + PNG_OPTION_ON); + +The PNG spec requirement that only grayscale profiles may appear in images +with color type 0 or 4 and that even if the image only contains gray pixels, +only RGB profiles may appear in images with color type 2, 3, or 6, is now +enforced. The sRGB chunk is allowed to appear in images with any color type +and is interpreted by libpng to convey a one-tracer-curve profile or a +three-tracer-curve profile as appropriate. Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained an empty language field or an empty translated keyword. Both of these @@ -5261,7 +5269,7 @@ Other rules can be inferred by inspecting the libpng source. XVI. Y2K Compliance in libpng -April 26, 2014 +May 7, 2014 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. diff --git a/libpng.3 b/libpng.3 index cf2bffbea..1fd5b1b02 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,4 +1,4 @@ -.TH LIBPNG 3 "April 26, 2014" +.TH LIBPNG 3 "May 7, 2014" .SH NAME libpng \- Portable Network Graphics (PNG) Reference Library 1.6.11beta06 .SH SYNOPSIS @@ -504,7 +504,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng. .SH LIBPNG.TXT libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.11beta06 - April 26, 2014 + libpng version 1.6.11beta06 - May 7, 2014 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson @@ -515,7 +515,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.6.11beta06 - April 26, 2014 + libpng versions 0.97, January 1998, through 1.6.11beta06 - May 7, 2014 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson @@ -5542,11 +5542,19 @@ Error detection in some chunks has improved; in particular the iCCP chunk reader now does pretty complete validation of the basic format. Some bad profiles that were previously accepted are now accepted with a warning or rejected, depending upon the png_set_benign_errors() setting, in particular the -very old broken Microsoft/HP 3144-byte sRGB profile. The PNG spec requirement -that only grayscale profiles may appear in images with color type 0 or 4 and -that even if the image only contains gray pixels, only RGB profiles may appear -in images with color type 2, 3, or 6, is now enforced. The sRGB chunk -is allowed to appear in images with any color type. +very old broken Microsoft/HP 3144-byte sRGB profile. Starting with +libpng-1.6.11, recognizing and checking sRGB profiles can be avoided by +means of + + png_set_option(ping, PNG_SKIP_sRGB_CHECK_PROFILE, + PNG_OPTION_ON); + +The PNG spec requirement that only grayscale profiles may appear in images +with color type 0 or 4 and that even if the image only contains gray pixels, +only RGB profiles may appear in images with color type 2, 3, or 6, is now +enforced. The sRGB chunk is allowed to appear in images with any color type +and is interpreted by libpng to convey a one-tracer-curve profile or a +three-tracer-curve profile as appropriate. Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained an empty language field or an empty translated keyword. Both of these @@ -5765,7 +5773,7 @@ Other rules can be inferred by inspecting the libpng source. .SH XVI. Y2K Compliance in libpng -April 26, 2014 +May 7, 2014 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. @@ -6062,7 +6070,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.6.11beta06 - April 26, 2014: +Libpng version 1.6.11beta06 - May 7, 2014: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). @@ -6085,7 +6093,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.2.6, August 15, 2004, through 1.6.11beta06, April 26, 2014, are +libpng versions 1.2.6, August 15, 2004, through 1.6.11beta06, May 7, 2014, are Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.2.5 with the following individual added to the list of Contributing Authors @@ -6184,7 +6192,7 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson glennrp at users.sourceforge.net -April 26, 2014 +May 7, 2014 .\" end of man page diff --git a/png.c b/png.c index d6f13dfd0..cd109629f 100644 --- a/png.c +++ b/png.c @@ -773,13 +773,13 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.11beta06 - April 26, 2014" PNG_STRING_NEWLINE \ + "libpng version 1.6.11beta06 - May 7, 2014" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.6.11beta06 - April 26, 2014\ + return "libpng version 1.6.11beta06 - May 7, 2014\ Copyright (c) 1998-2014 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; @@ -2211,11 +2211,18 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr, * by sRGB (but maybe defined by a later ICC specification) the read of * the profile will fail at that point. */ + + /* First see if PNG_SKIP_sRGB_CHECK_PROFILE has been set to "on" */ + if (((png_ptr->options >> PNG_SKIP_sRGB_CHECK_PROFILE) & 3) == + PNG_OPTION_ON) + return 0; + png_uint_32 length = 0; png_uint_32 intent = 0x10000; /* invalid */ #if PNG_sRGB_PROFILE_CHECKS > 1 uLong crc = 0; /* the value for 0 length data */ #endif + unsigned int i; for (i=0; i < (sizeof png_sRGB_checks) / (sizeof png_sRGB_checks[0]); ++i) diff --git a/png.h b/png.h index aa88b3eaf..fbdaa9c37 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.11beta06 - April 26, 2014 + * libpng version 1.6.11beta06 - May 7, 2014 * Copyright (c) 1998-2014 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -11,7 +11,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.6.11beta06 - April 26, 2014: Glenn + * libpng versions 0.97, January 1998, through 1.6.11beta06 - May 7, 2014: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -227,7 +227,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.2.6, August 15, 2004, through 1.6.11beta06, April 26, 2014, are + * libpng versions 1.2.6, August 15, 2004, through 1.6.11beta06, May 7, 2014, are * Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: @@ -339,7 +339,7 @@ * Y2K compliance in libpng: * ========================= * - * April 26, 2014 + * May 7, 2014 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. @@ -409,7 +409,7 @@ /* Version information for png.h - this should match the version in png.c */ #define PNG_LIBPNG_VER_STRING "1.6.11beta06" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.6.11beta06 - April 26, 2014\n" + " libpng version 1.6.11beta06 - May 7, 2014\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 @@ -3226,7 +3226,8 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr, # define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */ #endif #define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */ -#define PNG_OPTION_NEXT 4 /* Next option - numbers must be even */ +#define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */ +#define PNG_OPTION_NEXT 6 /* Next option - numbers must be even */ /* Return values: NOTE: there are four values and 'off' is *not* zero */ #define PNG_OPTION_UNSET 0 /* Unset - defaults to off */