mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-12-23 02:39:19 +00:00
libpng updated to version 1.6.20.
This commit is contained in:
parent
6d2adb576d
commit
539a46ad8d
18 changed files with 335 additions and 392 deletions
|
@ -10,10 +10,11 @@ this sentence.
|
|||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.6.18, July 23, 2015, are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.0.6
|
||||
with the following individuals added to the list of Contributing Authors:
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.6.20, December 3, 2015, are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
|
||||
derived from libpng-1.0.6, and are distributed according to the same
|
||||
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||
added to the list of Contributing Authors:
|
||||
|
||||
Simon-Pierre Cadieux
|
||||
Eric S. Raymond
|
||||
|
@ -32,18 +33,20 @@ and with the following additions to the disclaimer:
|
|||
the user.
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||
Copyright (c) 1998-2000 Glenn Randers-Pehrson, and are distributed according
|
||||
to the same disclaimer and license as libpng-0.96, with the following
|
||||
individuals added to the list of Contributing Authors:
|
||||
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
||||
libpng-0.96, and are distributed according to the same disclaimer and
|
||||
license as libpng-0.96, with the following individuals added to the list
|
||||
of Contributing Authors:
|
||||
|
||||
Tom Lane
|
||||
Glenn Randers-Pehrson
|
||||
Willem van Schaik
|
||||
|
||||
libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||
Copyright (c) 1996-1997 Andreas Dilger, and are
|
||||
distributed according to the same disclaimer and license as libpng-0.88,
|
||||
with the following individuals added to the list of Contributing Authors:
|
||||
Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
|
||||
and are distributed according to the same disclaimer and license as
|
||||
libpng-0.88, with the following individuals added to the list of
|
||||
Contributing Authors:
|
||||
|
||||
John Bowler
|
||||
Kevin Bracey
|
||||
|
@ -90,6 +93,8 @@ supporting the PNG file format in commercial products. If you use this
|
|||
source code in a product, acknowledgment is not required but would be
|
||||
appreciated.
|
||||
|
||||
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
||||
|
||||
A "png_get_copyright" function is available, for convenient use in "about"
|
||||
boxes and the like:
|
||||
|
||||
|
@ -104,4 +109,4 @@ the additional disclaimers inserted at version 1.0.7.
|
|||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
July 23, 2015
|
||||
December 3, 2015
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
|
@ -14,7 +14,7 @@
|
|||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_18 Your_png_h_is_not_version_1_6_18;
|
||||
typedef png_libpng_version_1_6_20 Your_png_h_is_not_version_1_6_20;
|
||||
|
||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
||||
* of the PNG file signature. If the PNG data is embedded into another
|
||||
|
@ -26,15 +26,20 @@ typedef png_libpng_version_1_6_18 Your_png_h_is_not_version_1_6_18;
|
|||
void PNGAPI
|
||||
png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
|
||||
{
|
||||
unsigned int nb = (unsigned int)num_bytes;
|
||||
|
||||
png_debug(1, "in png_set_sig_bytes");
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (num_bytes > 8)
|
||||
if (num_bytes < 0)
|
||||
nb = 0;
|
||||
|
||||
if (nb > 8)
|
||||
png_error(png_ptr, "Too many bytes for PNG signature");
|
||||
|
||||
png_ptr->sig_bytes = (png_byte)((num_bytes < 0 ? 0 : num_bytes) & 0xff);
|
||||
png_ptr->sig_bytes = (png_byte)nb;
|
||||
}
|
||||
|
||||
/* Checks whether the supplied bytes match the PNG signature. We allow
|
||||
|
@ -413,6 +418,8 @@ png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size),
|
|||
free(info_ptr);
|
||||
info_ptr = png_voidcast(png_inforp, png_malloc_base(NULL,
|
||||
(sizeof *info_ptr)));
|
||||
if (info_ptr == NULL)
|
||||
return;
|
||||
*ptr_ptr = info_ptr;
|
||||
}
|
||||
|
||||
|
@ -664,19 +671,20 @@ png_init_io(png_structrp png_ptr, png_FILE_p fp)
|
|||
# endif
|
||||
|
||||
# ifdef PNG_SAVE_INT_32_SUPPORTED
|
||||
/* The png_save_int_32 function assumes integers are stored in two's
|
||||
* complement format. If this isn't the case, then this routine needs to
|
||||
* be modified to write data in two's complement format. Note that,
|
||||
* the following works correctly even if png_int_32 has more than 32 bits
|
||||
* (compare the more complex code required on read for sign extension.)
|
||||
/* PNG signed integers are saved in 32-bit 2's complement format. ANSI C-90
|
||||
* defines a cast of a signed integer to an unsigned integer either to preserve
|
||||
* the value, if it is positive, or to calculate:
|
||||
*
|
||||
* (UNSIGNED_MAX+1) + integer
|
||||
*
|
||||
* Where UNSIGNED_MAX is the appropriate maximum unsigned value, so when the
|
||||
* negative integral value is added the result will be an unsigned value
|
||||
* correspnding to the 2's complement representation.
|
||||
*/
|
||||
void PNGAPI
|
||||
png_save_int_32(png_bytep buf, png_int_32 i)
|
||||
{
|
||||
buf[0] = (png_byte)((i >> 24) & 0xff);
|
||||
buf[1] = (png_byte)((i >> 16) & 0xff);
|
||||
buf[2] = (png_byte)((i >> 8) & 0xff);
|
||||
buf[3] = (png_byte)(i & 0xff);
|
||||
png_save_uint_32(buf, i);
|
||||
}
|
||||
# endif
|
||||
|
||||
|
@ -722,6 +730,7 @@ png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime)
|
|||
APPEND(':');
|
||||
APPEND_NUMBER(PNG_NUMBER_FORMAT_02u, (unsigned)ptime->second);
|
||||
APPEND_STRING(" +0000"); /* This reliably terminates the buffer */
|
||||
PNG_UNUSED (pos)
|
||||
|
||||
# undef APPEND
|
||||
# undef APPEND_NUMBER
|
||||
|
@ -766,13 +775,13 @@ png_get_copyright(png_const_structrp png_ptr)
|
|||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.18 - July 23, 2015" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.20 - December 3, 2015" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2015 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.18 - July 23, 2015\
|
||||
return "libpng version 1.6.20 - December 3, 2015\
|
||||
Copyright (c) 1998-2015 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
|
@ -1703,7 +1712,6 @@ png_colorspace_set_chromaticities(png_const_structrp png_ptr,
|
|||
*/
|
||||
colorspace->flags |= PNG_COLORSPACE_INVALID;
|
||||
png_error(png_ptr, "internal error checking chromaticities");
|
||||
break;
|
||||
}
|
||||
|
||||
return 0; /* failed */
|
||||
|
@ -1731,7 +1739,6 @@ png_colorspace_set_endpoints(png_const_structrp png_ptr,
|
|||
default:
|
||||
colorspace->flags |= PNG_COLORSPACE_INVALID;
|
||||
png_error(png_ptr, "internal error checking chromaticities");
|
||||
break;
|
||||
}
|
||||
|
||||
return 0; /* failed */
|
||||
|
@ -2057,8 +2064,8 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||
temp = png_get_uint_32(profile+12); /* profile/device class */
|
||||
switch (temp)
|
||||
{
|
||||
case 0x73636E72: /* 'scnr' */
|
||||
case 0x6D6E7472: /* 'mntr' */
|
||||
case 0x73636e72: /* 'scnr' */
|
||||
case 0x6d6e7472: /* 'mntr' */
|
||||
case 0x70727472: /* 'prtr' */
|
||||
case 0x73706163: /* 'spac' */
|
||||
/* All supported */
|
||||
|
@ -2069,7 +2076,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||
return png_icc_profile_error(png_ptr, colorspace, name, temp,
|
||||
"invalid embedded Abstract ICC profile");
|
||||
|
||||
case 0x6C696E6B: /* 'link' */
|
||||
case 0x6c696e6b: /* 'link' */
|
||||
/* DeviceLink profiles cannot be interpreted in a non-device specific
|
||||
* fashion, if an app uses the AToB0Tag in the profile the results are
|
||||
* undefined unless the result is sent to the intended device,
|
||||
|
@ -2079,7 +2086,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||
return png_icc_profile_error(png_ptr, colorspace, name, temp,
|
||||
"unexpected DeviceLink ICC profile class");
|
||||
|
||||
case 0x6E6D636C: /* 'nmcl' */
|
||||
case 0x6e6d636c: /* 'nmcl' */
|
||||
/* A NamedColor profile is also device specific, however it doesn't
|
||||
* contain an AToB0 tag that is open to misinterpretation. Almost
|
||||
* certainly it will fail the tests below.
|
||||
|
@ -2105,8 +2112,8 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||
temp = png_get_uint_32(profile+20);
|
||||
switch (temp)
|
||||
{
|
||||
case 0x58595A20: /* 'XYZ ' */
|
||||
case 0x4C616220: /* 'Lab ' */
|
||||
case 0x58595a20: /* 'XYZ ' */
|
||||
case 0x4c616220: /* 'Lab ' */
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2276,7 +2283,7 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
|
|||
}
|
||||
|
||||
/* Length *and* intent must match */
|
||||
if (length == png_sRGB_checks[i].length &&
|
||||
if (length == (png_uint_32) png_sRGB_checks[i].length &&
|
||||
intent == (png_uint_32) png_sRGB_checks[i].intent)
|
||||
{
|
||||
/* Now calculate the adler32 if not done already. */
|
||||
|
@ -2336,7 +2343,7 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
|
|||
* Fall through to "no match".
|
||||
*/
|
||||
png_chunk_report(png_ptr,
|
||||
"Not recognizing known sRGB profile that has been edited",
|
||||
"Not recognizing known sRGB profile that has been edited",
|
||||
PNG_CHUNK_WARNING);
|
||||
break;
|
||||
# endif
|
||||
|
@ -3144,7 +3151,7 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
|
|||
|
||||
/* Avoid overflow here on the minimum integer. */
|
||||
if (fp < 0)
|
||||
*ascii++ = 45, --size, num = -fp;
|
||||
*ascii++ = 45, num = -fp;
|
||||
else
|
||||
num = fp;
|
||||
|
||||
|
@ -3675,7 +3682,7 @@ png_exp(png_fixed_point x)
|
|||
if (x > 0 && x <= 0xfffff) /* Else overflow or zero (underflow) */
|
||||
{
|
||||
/* Obtain a 4-bit approximation */
|
||||
png_uint_32 e = png_32bit_exp[(x >> 12) & 0xf];
|
||||
png_uint_32 e = png_32bit_exp[(x >> 12) & 0x0f];
|
||||
|
||||
/* Incorporate the low 12 bits - these decrease the returned value by
|
||||
* multiplying by a number less than 1 if the bit is set. The multiplier
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.18, July 23, 2015
|
||||
* libpng version 1.6.20, December 3, 2015
|
||||
*
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -12,234 +12,9 @@
|
|||
* Authors and maintainers:
|
||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.6.18, July 23, 2015: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.6.20, December 3, 2015:
|
||||
* Glenn Randers-Pehrson.
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
*
|
||||
* Due to various miscommunications, unforeseen code incompatibilities
|
||||
* and occasional factors outside the authors' control, version numbering
|
||||
* on the library has not always been consistent and straightforward.
|
||||
* The following table summarizes matters since version 0.89c, which was
|
||||
* the first widely used release:
|
||||
*
|
||||
* source png.h png.h shared-lib
|
||||
* version string int version
|
||||
* ------- ------ ----- ----------
|
||||
* 0.89c "1.0 beta 3" 0.89 89 1.0.89
|
||||
* 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90]
|
||||
* 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95]
|
||||
* 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96]
|
||||
* 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97]
|
||||
* 0.97c 0.97 97 2.0.97
|
||||
* 0.98 0.98 98 2.0.98
|
||||
* 0.99 0.99 98 2.0.99
|
||||
* 0.99a-m 0.99 99 2.0.99
|
||||
* 1.00 1.00 100 2.1.0 [100 should be 10000]
|
||||
* 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000]
|
||||
* 1.0.1 png.h string is 10001 2.1.0
|
||||
* 1.0.1a-e identical to the 10002 from here on, the shared library
|
||||
* 1.0.2 source version) 10002 is 2.V where V is the source code
|
||||
* 1.0.2a-b 10003 version, except as noted.
|
||||
* 1.0.3 10003
|
||||
* 1.0.3a-d 10004
|
||||
* 1.0.4 10004
|
||||
* 1.0.4a-f 10005
|
||||
* 1.0.5 (+ 2 patches) 10005
|
||||
* 1.0.5a-d 10006
|
||||
* 1.0.5e-r 10100 (not source compatible)
|
||||
* 1.0.5s-v 10006 (not binary compatible)
|
||||
* 1.0.6 (+ 3 patches) 10006 (still binary incompatible)
|
||||
* 1.0.6d-f 10007 (still binary incompatible)
|
||||
* 1.0.6g 10007
|
||||
* 1.0.6h 10007 10.6h (testing xy.z so-numbering)
|
||||
* 1.0.6i 10007 10.6i
|
||||
* 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0)
|
||||
* 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible)
|
||||
* 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
|
||||
* 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
|
||||
* 1.0.7 1 10007 (still compatible)
|
||||
* 1.0.8beta1-4 1 10008 2.1.0.8beta1-4
|
||||
* 1.0.8rc1 1 10008 2.1.0.8rc1
|
||||
* 1.0.8 1 10008 2.1.0.8
|
||||
* 1.0.9beta1-6 1 10009 2.1.0.9beta1-6
|
||||
* 1.0.9rc1 1 10009 2.1.0.9rc1
|
||||
* 1.0.9beta7-10 1 10009 2.1.0.9beta7-10
|
||||
* 1.0.9rc2 1 10009 2.1.0.9rc2
|
||||
* 1.0.9 1 10009 2.1.0.9
|
||||
* 1.0.10beta1 1 10010 2.1.0.10beta1
|
||||
* 1.0.10rc1 1 10010 2.1.0.10rc1
|
||||
* 1.0.10 1 10010 2.1.0.10
|
||||
* 1.0.11beta1-3 1 10011 2.1.0.11beta1-3
|
||||
* 1.0.11rc1 1 10011 2.1.0.11rc1
|
||||
* 1.0.11 1 10011 2.1.0.11
|
||||
* 1.0.12beta1-2 2 10012 2.1.0.12beta1-2
|
||||
* 1.0.12rc1 2 10012 2.1.0.12rc1
|
||||
* 1.0.12 2 10012 2.1.0.12
|
||||
* 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned)
|
||||
* 1.2.0beta1-2 2 10200 2.1.2.0beta1-2
|
||||
* 1.2.0beta3-5 3 10200 3.1.2.0beta3-5
|
||||
* 1.2.0rc1 3 10200 3.1.2.0rc1
|
||||
* 1.2.0 3 10200 3.1.2.0
|
||||
* 1.2.1beta1-4 3 10201 3.1.2.1beta1-4
|
||||
* 1.2.1rc1-2 3 10201 3.1.2.1rc1-2
|
||||
* 1.2.1 3 10201 3.1.2.1
|
||||
* 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6
|
||||
* 1.0.13beta1 10 10013 10.so.0.1.0.13beta1
|
||||
* 1.0.13rc1 10 10013 10.so.0.1.0.13rc1
|
||||
* 1.2.2rc1 12 10202 12.so.0.1.2.2rc1
|
||||
* 1.0.13 10 10013 10.so.0.1.0.13
|
||||
* 1.2.2 12 10202 12.so.0.1.2.2
|
||||
* 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6
|
||||
* 1.2.3 12 10203 12.so.0.1.2.3
|
||||
* 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3
|
||||
* 1.0.14rc1 13 10014 10.so.0.1.0.14rc1
|
||||
* 1.2.4rc1 13 10204 12.so.0.1.2.4rc1
|
||||
* 1.0.14 10 10014 10.so.0.1.0.14
|
||||
* 1.2.4 13 10204 12.so.0.1.2.4
|
||||
* 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2
|
||||
* 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3
|
||||
* 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3
|
||||
* 1.0.15 10 10015 10.so.0.1.0.15
|
||||
* 1.2.5 13 10205 12.so.0.1.2.5
|
||||
* 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4
|
||||
* 1.0.16 10 10016 10.so.0.1.0.16
|
||||
* 1.2.6 13 10206 12.so.0.1.2.6
|
||||
* 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2
|
||||
* 1.0.17rc1 10 10017 12.so.0.1.0.17rc1
|
||||
* 1.2.7rc1 13 10207 12.so.0.1.2.7rc1
|
||||
* 1.0.17 10 10017 12.so.0.1.0.17
|
||||
* 1.2.7 13 10207 12.so.0.1.2.7
|
||||
* 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5
|
||||
* 1.0.18rc1-5 10 10018 12.so.0.1.0.18rc1-5
|
||||
* 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5
|
||||
* 1.0.18 10 10018 12.so.0.1.0.18
|
||||
* 1.2.8 13 10208 12.so.0.1.2.8
|
||||
* 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3
|
||||
* 1.2.9beta4-11 13 10209 12.so.0.9[.0]
|
||||
* 1.2.9rc1 13 10209 12.so.0.9[.0]
|
||||
* 1.2.9 13 10209 12.so.0.9[.0]
|
||||
* 1.2.10beta1-7 13 10210 12.so.0.10[.0]
|
||||
* 1.2.10rc1-2 13 10210 12.so.0.10[.0]
|
||||
* 1.2.10 13 10210 12.so.0.10[.0]
|
||||
* 1.4.0beta1-5 14 10400 14.so.0.0[.0]
|
||||
* 1.2.11beta1-4 13 10211 12.so.0.11[.0]
|
||||
* 1.4.0beta7-8 14 10400 14.so.0.0[.0]
|
||||
* 1.2.11 13 10211 12.so.0.11[.0]
|
||||
* 1.2.12 13 10212 12.so.0.12[.0]
|
||||
* 1.4.0beta9-14 14 10400 14.so.0.0[.0]
|
||||
* 1.2.13 13 10213 12.so.0.13[.0]
|
||||
* 1.4.0beta15-36 14 10400 14.so.0.0[.0]
|
||||
* 1.4.0beta37-87 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0rc01 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0beta88-109 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0rc02-08 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0 14 10400 14.so.14.0[.0]
|
||||
* 1.4.1beta01-03 14 10401 14.so.14.1[.0]
|
||||
* 1.4.1rc01 14 10401 14.so.14.1[.0]
|
||||
* 1.4.1beta04-12 14 10401 14.so.14.1[.0]
|
||||
* 1.4.1 14 10401 14.so.14.1[.0]
|
||||
* 1.4.2 14 10402 14.so.14.2[.0]
|
||||
* 1.4.3 14 10403 14.so.14.3[.0]
|
||||
* 1.4.4 14 10404 14.so.14.4[.0]
|
||||
* 1.5.0beta01-58 15 10500 15.so.15.0[.0]
|
||||
* 1.5.0rc01-07 15 10500 15.so.15.0[.0]
|
||||
* 1.5.0 15 10500 15.so.15.0[.0]
|
||||
* 1.5.1beta01-11 15 10501 15.so.15.1[.0]
|
||||
* 1.5.1rc01-02 15 10501 15.so.15.1[.0]
|
||||
* 1.5.1 15 10501 15.so.15.1[.0]
|
||||
* 1.5.2beta01-03 15 10502 15.so.15.2[.0]
|
||||
* 1.5.2rc01-03 15 10502 15.so.15.2[.0]
|
||||
* 1.5.2 15 10502 15.so.15.2[.0]
|
||||
* 1.5.3beta01-10 15 10503 15.so.15.3[.0]
|
||||
* 1.5.3rc01-02 15 10503 15.so.15.3[.0]
|
||||
* 1.5.3beta11 15 10503 15.so.15.3[.0]
|
||||
* 1.5.3 [omitted]
|
||||
* 1.5.4beta01-08 15 10504 15.so.15.4[.0]
|
||||
* 1.5.4rc01 15 10504 15.so.15.4[.0]
|
||||
* 1.5.4 15 10504 15.so.15.4[.0]
|
||||
* 1.5.5beta01-08 15 10505 15.so.15.5[.0]
|
||||
* 1.5.5rc01 15 10505 15.so.15.5[.0]
|
||||
* 1.5.5 15 10505 15.so.15.5[.0]
|
||||
* 1.5.6beta01-07 15 10506 15.so.15.6[.0]
|
||||
* 1.5.6rc01-03 15 10506 15.so.15.6[.0]
|
||||
* 1.5.6 15 10506 15.so.15.6[.0]
|
||||
* 1.5.7beta01-05 15 10507 15.so.15.7[.0]
|
||||
* 1.5.7rc01-03 15 10507 15.so.15.7[.0]
|
||||
* 1.5.7 15 10507 15.so.15.7[.0]
|
||||
* 1.6.0beta01-40 16 10600 16.so.16.0[.0]
|
||||
* 1.6.0rc01-08 16 10600 16.so.16.0[.0]
|
||||
* 1.6.0 16 10600 16.so.16.0[.0]
|
||||
* 1.6.1beta01-09 16 10601 16.so.16.1[.0]
|
||||
* 1.6.1rc01 16 10601 16.so.16.1[.0]
|
||||
* 1.6.1 16 10601 16.so.16.1[.0]
|
||||
* 1.6.2beta01 16 10602 16.so.16.2[.0]
|
||||
* 1.6.2rc01-06 16 10602 16.so.16.2[.0]
|
||||
* 1.6.2 16 10602 16.so.16.2[.0]
|
||||
* 1.6.3beta01-11 16 10603 16.so.16.3[.0]
|
||||
* 1.6.3rc01 16 10603 16.so.16.3[.0]
|
||||
* 1.6.3 16 10603 16.so.16.3[.0]
|
||||
* 1.6.4beta01-02 16 10604 16.so.16.4[.0]
|
||||
* 1.6.4rc01 16 10604 16.so.16.4[.0]
|
||||
* 1.6.4 16 10604 16.so.16.4[.0]
|
||||
* 1.6.5 16 10605 16.so.16.5[.0]
|
||||
* 1.6.6 16 10606 16.so.16.6[.0]
|
||||
* 1.6.7beta01-04 16 10607 16.so.16.7[.0]
|
||||
* 1.6.7rc01-03 16 10607 16.so.16.7[.0]
|
||||
* 1.6.7 16 10607 16.so.16.7[.0]
|
||||
* 1.6.8beta01-02 16 10608 16.so.16.8[.0]
|
||||
* 1.6.8rc01-02 16 10608 16.so.16.8[.0]
|
||||
* 1.6.8 16 10608 16.so.16.8[.0]
|
||||
* 1.6.9beta01-04 16 10609 16.so.16.9[.0]
|
||||
* 1.6.9rc01-02 16 10609 16.so.16.9[.0]
|
||||
* 1.6.9 16 10609 16.so.16.9[.0]
|
||||
* 1.6.10beta01-03 16 10610 16.so.16.10[.0]
|
||||
* 1.6.10rc01-03 16 10610 16.so.16.10[.0]
|
||||
* 1.6.10 16 10610 16.so.16.10[.0]
|
||||
* 1.6.11beta01-06 16 10611 16.so.16.11[.0]
|
||||
* 1.6.11rc01-02 16 10611 16.so.16.11[.0]
|
||||
* 1.6.11 16 10611 16.so.16.11[.0]
|
||||
* 1.6.12rc01-03 16 10612 16.so.16.12[.0]
|
||||
* 1.6.12 16 10612 16.so.16.12[.0]
|
||||
* 1.6.13beta01-04 16 10613 16.so.16.13[.0]
|
||||
* 1.6.13rc01-02 16 10613 16.so.16.13[.0]
|
||||
* 1.6.13 16 10613 16.so.16.13[.0]
|
||||
* 1.6.14beta01-07 16 10614 16.so.16.14[.0]
|
||||
* 1.6.14rc01-02 16 10614 16.so.16.14[.0]
|
||||
* 1.6.14 16 10614 16.so.16.14[.0]
|
||||
* 1.6.15beta01-08 16 10615 16.so.16.15[.0]
|
||||
* 1.6.15rc01-03 16 10615 16.so.16.15[.0]
|
||||
* 1.6.15 16 10615 16.so.16.15[.0]
|
||||
* 1.6.16beta01-03 16 10616 16.so.16.16[.0]
|
||||
* 1.6.16rc01-02 16 10616 16.so.16.16[.0]
|
||||
* 1.6.16 16 10616 16.so.16.16[.0]
|
||||
* 1.6.17beta01-06 16 10617 16.so.16.17[.0]
|
||||
* 1.6.17rc01-06 16 10617 16.so.16.17[.0]
|
||||
* 1.6.17 16 10617 16.so.16.17[.0]
|
||||
* 1.6.18beta01-09 16 10618 16.so.16.18[.0]
|
||||
* 1.6.18rc01-03 16 10618 16.so.16.18[.0]
|
||||
* 1.6.18 16 10618 16.so.16.18[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
* used for changes in backward compatibility, as it is intended. The
|
||||
* PNG_LIBPNG_VER macro, which is not used within libpng but is available
|
||||
* for applications, is an unsigned integer of the form xyyzz corresponding
|
||||
* to the source version x.y.z (leading zeros in y and z). Beta versions
|
||||
* were given the previous public release number plus a letter, until
|
||||
* version 1.0.6j; from then on they were given the upcoming public
|
||||
* release number plus "betaNN" or "rcNN".
|
||||
*
|
||||
* Binary incompatibility exists only when applications make direct access
|
||||
* to the info_ptr or png_ptr members through png.h, and the compiled
|
||||
* application is loaded with a different version of the library.
|
||||
*
|
||||
* DLLNUM will change each time there are forward or backward changes
|
||||
* in binary compatibility (e.g., when a new feature is added).
|
||||
*
|
||||
* See libpng-manual.txt or libpng.3 for more information. The PNG
|
||||
* specification is available as a W3C Recommendation and as an ISO
|
||||
* Specification, <http://www.w3.org/TR/2003/REC-PNG-20031110/
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -250,12 +25,14 @@
|
|||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.0.7, July 1, 2000, through 1.6.18, July 23, 2015, are
|
||||
* Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, and are
|
||||
* distributed according to the same disclaimer and license as libpng-1.0.6
|
||||
* with the following individuals added to the list of Contributing Authors:
|
||||
* libpng versions 1.0.7, July 1, 2000, through 1.6.20, December 3, 2015, are
|
||||
* Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
|
||||
* derived from libpng-1.0.6, and are distributed according to the same
|
||||
* disclaimer and license as libpng-1.0.6 with the following individuals
|
||||
* added to the list of Contributing Authors:
|
||||
*
|
||||
* Simon-Pierre Cadieux
|
||||
* Eric S. Raymond
|
||||
* Mans Rullgard
|
||||
* Cosmin Truta
|
||||
* Gilles Vollant
|
||||
|
@ -271,19 +48,20 @@
|
|||
* the user.
|
||||
*
|
||||
* libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||
* Copyright (c) 1998-2000 Glenn Randers-Pehrson, and are distributed according
|
||||
* to the same disclaimer and license as libpng-0.96, with the following
|
||||
* individuals added to the list of Contributing Authors:
|
||||
* Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
||||
* libpng-0.96, and are distributed according to the same disclaimer and
|
||||
* license as libpng-0.96, with the following individuals added to the list
|
||||
* of Contributing Authors:
|
||||
*
|
||||
* Tom Lane
|
||||
* Glenn Randers-Pehrson
|
||||
* Eric S. Raymond
|
||||
* Willem van Schaik
|
||||
*
|
||||
* libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||
* Copyright (c) 1996-1997 Andreas Dilger, and are
|
||||
* distributed according to the same disclaimer and license as libpng-0.88,
|
||||
* with the following individuals added to the list of Contributing Authors:
|
||||
* Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
|
||||
* and are distributed according to the same disclaimer and license as
|
||||
* libpng-0.88, with the following individuals added to the list of
|
||||
* Contributing Authors:
|
||||
*
|
||||
* John Bowler
|
||||
* Kevin Bracey
|
||||
|
@ -329,6 +107,8 @@
|
|||
* supporting the PNG file format in commercial products. If you use this
|
||||
* source code in a product, acknowledgment is not required but would be
|
||||
* appreciated.
|
||||
*
|
||||
* END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -355,17 +135,92 @@
|
|||
* Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
*/
|
||||
|
||||
/* Note about libpng version numbers:
|
||||
*
|
||||
* Due to various miscommunications, unforeseen code incompatibilities
|
||||
* and occasional factors outside the authors' control, version numbering
|
||||
* on the library has not always been consistent and straightforward.
|
||||
* The following table summarizes matters since version 0.89c, which was
|
||||
* the first widely used release:
|
||||
*
|
||||
* source png.h png.h shared-lib
|
||||
* version string int version
|
||||
* ------- ------ ----- ----------
|
||||
* 0.89c "1.0 beta 3" 0.89 89 1.0.89
|
||||
* 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90]
|
||||
* 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95]
|
||||
* 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96]
|
||||
* 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97]
|
||||
* 0.97c 0.97 97 2.0.97
|
||||
* 0.98 0.98 98 2.0.98
|
||||
* 0.99 0.99 98 2.0.99
|
||||
* 0.99a-m 0.99 99 2.0.99
|
||||
* 1.00 1.00 100 2.1.0 [100 should be 10000]
|
||||
* 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000]
|
||||
* 1.0.1 png.h string is 10001 2.1.0
|
||||
* 1.0.1a-e identical to the 10002 from here on, the shared library
|
||||
* 1.0.2 source version) 10002 is 2.V where V is the source code
|
||||
* 1.0.2a-b 10003 version, except as noted.
|
||||
* 1.0.3 10003
|
||||
* 1.0.3a-d 10004
|
||||
* 1.0.4 10004
|
||||
* 1.0.4a-f 10005
|
||||
* 1.0.5 (+ 2 patches) 10005
|
||||
* 1.0.5a-d 10006
|
||||
* 1.0.5e-r 10100 (not source compatible)
|
||||
* 1.0.5s-v 10006 (not binary compatible)
|
||||
* 1.0.6 (+ 3 patches) 10006 (still binary incompatible)
|
||||
* 1.0.6d-f 10007 (still binary incompatible)
|
||||
* 1.0.6g 10007
|
||||
* 1.0.6h 10007 10.6h (testing xy.z so-numbering)
|
||||
* 1.0.6i 10007 10.6i
|
||||
* 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0)
|
||||
* 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible)
|
||||
* 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
|
||||
* 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
|
||||
* 1.0.7 1 10007 (still compatible)
|
||||
* ...
|
||||
* 1.0.19 10 10019 10.so.0.19[.0]
|
||||
* ...
|
||||
* 1.2.53 13 10253 12.so.0.53[.0]
|
||||
* ...
|
||||
* 1.5.23 15 10523 15.so.15.23[.0]
|
||||
* ...
|
||||
* 1.6.20 16 10620 16.so.16.20[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
* used for changes in backward compatibility, as it is intended. The
|
||||
* PNG_LIBPNG_VER macro, which is not used within libpng but is available
|
||||
* for applications, is an unsigned integer of the form xyyzz corresponding
|
||||
* to the source version x.y.z (leading zeros in y and z). Beta versions
|
||||
* were given the previous public release number plus a letter, until
|
||||
* version 1.0.6j; from then on they were given the upcoming public
|
||||
* release number plus "betaNN" or "rcNN".
|
||||
*
|
||||
* Binary incompatibility exists only when applications make direct access
|
||||
* to the info_ptr or png_ptr members through png.h, and the compiled
|
||||
* application is loaded with a different version of the library.
|
||||
*
|
||||
* DLLNUM will change each time there are forward or backward changes
|
||||
* in binary compatibility (e.g., when a new feature is added).
|
||||
*
|
||||
* See libpng.txt or libpng.3 for more information. The PNG specification
|
||||
* is available as a W3C Recommendation and as an ISO Specification,
|
||||
* <http://www.w3.org/TR/2003/REC-PNG-20031110/
|
||||
*/
|
||||
|
||||
/*
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* July 23, 2015
|
||||
* December 3, 2015
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.6.18 are Y2K compliant. It is my belief that
|
||||
* upward through 1.6.20 are Y2K compliant. It is my belief that
|
||||
* earlier versions were also Y2K compliant.
|
||||
*
|
||||
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
|
@ -427,9 +282,9 @@
|
|||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.18"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.20"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.6.18 - July 23, 2015\n"
|
||||
" libpng version 1.6.20 - December 3, 2015\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
|
@ -437,7 +292,7 @@
|
|||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 6
|
||||
#define PNG_LIBPNG_VER_RELEASE 18
|
||||
#define PNG_LIBPNG_VER_RELEASE 20
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
|
@ -468,7 +323,7 @@
|
|||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||
*/
|
||||
#define PNG_LIBPNG_VER 10618 /* 1.6.18 */
|
||||
#define PNG_LIBPNG_VER 10620 /* 1.6.20 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
|
@ -525,17 +380,22 @@ extern "C" {
|
|||
|
||||
/* This file is arranged in several sections:
|
||||
*
|
||||
* 1. Any configuration options that can be specified by for the application
|
||||
* 1. [omitted]
|
||||
* 2. Any configuration options that can be specified by for the application
|
||||
* code when it is built. (Build time configuration is in pnglibconf.h)
|
||||
* 2. Type definitions (base types are defined in pngconf.h), structure
|
||||
* 3. Type definitions (base types are defined in pngconf.h), structure
|
||||
* definitions.
|
||||
* 3. Exported library functions.
|
||||
* 4. Simplified API.
|
||||
* 4. Exported library functions.
|
||||
* 5. Simplified API.
|
||||
* 6. Implementation options.
|
||||
*
|
||||
* The library source code has additional files (principally pngpriv.h) that
|
||||
* allow configuration of the library.
|
||||
*/
|
||||
/* Section 1: run time configuration
|
||||
|
||||
/* Section 1: [omitted] */
|
||||
|
||||
/* Section 2: run time configuration
|
||||
* See pnglibconf.h for build time configuration
|
||||
*
|
||||
* Run time configuration allows the application to choose between
|
||||
|
@ -565,7 +425,7 @@ extern "C" {
|
|||
* Otherwise the calls are mapped to png_error.
|
||||
*/
|
||||
|
||||
/* Section 2: type definitions, including structures and compile time
|
||||
/* Section 3: type definitions, including structures and compile time
|
||||
* constants.
|
||||
* See pngconf.h for base types that vary by machine/system
|
||||
*/
|
||||
|
@ -573,7 +433,7 @@ extern "C" {
|
|||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef char* png_libpng_version_1_6_18;
|
||||
typedef char* png_libpng_version_1_6_20;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
|
@ -889,7 +749,9 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
|
|||
#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */
|
||||
#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
|
||||
#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
|
||||
#if INT_MAX >= 0x8000 /* else this might break */
|
||||
#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
|
||||
#endif
|
||||
|
||||
/* This is used for the transformation routines, as some of them
|
||||
* change these values for the row. It also should enable using
|
||||
|
@ -993,7 +855,9 @@ PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef);
|
|||
#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
|
||||
/* Added to libpng-1.5.4 */
|
||||
#define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */
|
||||
#if INT_MAX >= 0x8000 /* else this might break */
|
||||
#define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */
|
||||
#endif
|
||||
|
||||
/* Flags for MNG supported features */
|
||||
#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
|
||||
|
@ -1010,7 +874,7 @@ typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr, (png_structp,
|
|||
png_alloc_size_t));
|
||||
typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp));
|
||||
|
||||
/* Section 3: exported functions
|
||||
/* Section 4: exported functions
|
||||
* Here are the function definitions most commonly used. This is not
|
||||
* the place to find out how to use libpng. See libpng-manual.txt for the
|
||||
* full explanation, see example.c for the summary. This just provides
|
||||
|
@ -1383,13 +1247,13 @@ PNG_EXPORT(38, void, png_set_invert_alpha, (png_structrp png_ptr));
|
|||
#endif
|
||||
|
||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||
/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */
|
||||
/* Add a filler byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */
|
||||
PNG_EXPORT(39, void, png_set_filler, (png_structrp png_ptr, png_uint_32 filler,
|
||||
int flags));
|
||||
/* The values of the PNG_FILLER_ defines should NOT be changed */
|
||||
# define PNG_FILLER_BEFORE 0
|
||||
# define PNG_FILLER_AFTER 1
|
||||
/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
|
||||
/* Add an alpha byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */
|
||||
PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr,
|
||||
png_uint_32 filler, int flags));
|
||||
#endif /* READ_FILLER || WRITE_FILLER */
|
||||
|
@ -2714,7 +2578,7 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
|
|||
|
||||
# define PNG_get_int_32(buf) \
|
||||
((png_int_32)((*(buf) & 0x80) \
|
||||
? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \
|
||||
? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
|
||||
: (png_int_32)png_get_uint_32(buf)))
|
||||
|
||||
/* If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h,
|
||||
|
@ -2734,10 +2598,17 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
|
||||
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
|
||||
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
PNG_EXPORT(242, void, png_set_check_for_invalid_index,
|
||||
(png_structrp png_ptr, int allowed));
|
||||
# ifdef PNG_GET_PALETTE_MAX_SUPPORTED
|
||||
PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
|
||||
png_const_infop info_ptr));
|
||||
# endif
|
||||
#endif /* CHECK_FOR_INVALID_INDEX */
|
||||
|
||||
/*******************************************************************************
|
||||
* SIMPLIFIED API
|
||||
* Section 5: SIMPLIFIED API
|
||||
*******************************************************************************
|
||||
*
|
||||
* Please read the documentation in libpng-manual.txt (TODO: write said
|
||||
|
@ -2782,6 +2653,9 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
|
|||
* when it is being read or defines the in-memory format of an image that you
|
||||
* need to write:
|
||||
*/
|
||||
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
|
||||
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
|
||||
|
||||
#define PNG_IMAGE_VERSION 1
|
||||
|
||||
typedef struct png_control *png_controlp;
|
||||
|
@ -2881,7 +2755,7 @@ typedef struct
|
|||
* called to read or write the color-map and set the format correctly for the
|
||||
* image data. Do not set the PNG_FORMAT_FLAG_COLORMAP bit directly!
|
||||
*
|
||||
* NOTE: libpng can be built with particular features disabled, if you see
|
||||
* NOTE: libpng can be built with particular features disabled. If you see
|
||||
* compiler errors because the definition of one of the following flags has been
|
||||
* compiled out it is because libpng does not have the required support. It is
|
||||
* possible, however, for the libpng configuration to enable the format on just
|
||||
|
@ -2893,7 +2767,7 @@ typedef struct
|
|||
*/
|
||||
#define PNG_FORMAT_FLAG_ALPHA 0x01U /* format with an alpha channel */
|
||||
#define PNG_FORMAT_FLAG_COLOR 0x02U /* color format: otherwise grayscale */
|
||||
#define PNG_FORMAT_FLAG_LINEAR 0x04U /* 2 byte channels else 1 byte */
|
||||
#define PNG_FORMAT_FLAG_LINEAR 0x04U /* 2-byte channels else 1-byte */
|
||||
#define PNG_FORMAT_FLAG_COLORMAP 0x08U /* image data is color-mapped */
|
||||
|
||||
#ifdef PNG_FORMAT_BGR_SUPPORTED
|
||||
|
@ -3193,17 +3067,8 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
|
|||
******************************************************************************/
|
||||
#endif /* SIMPLIFIED_{READ|WRITE} */
|
||||
|
||||
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
PNG_EXPORT(242, void, png_set_check_for_invalid_index,
|
||||
(png_structrp png_ptr, int allowed));
|
||||
# ifdef PNG_GET_PALETTE_MAX_SUPPORTED
|
||||
PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
|
||||
png_const_infop info_ptr));
|
||||
# endif
|
||||
#endif /* CHECK_FOR_INVALID_INDEX */
|
||||
|
||||
/*******************************************************************************
|
||||
* IMPLEMENTATION OPTIONS
|
||||
* Section 6: IMPLEMENTATION OPTIONS
|
||||
*******************************************************************************
|
||||
*
|
||||
* Support for arbitrary implementation-specific optimizations. The API allows
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.18, July 23, 2015
|
||||
* libpng version 1.6.20, December 3, 2015
|
||||
*
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -63,7 +63,7 @@
|
|||
*/
|
||||
#define PNG_CONST const /* backward compatibility only */
|
||||
|
||||
/* This controls optimization of the reading of 16 and 32 bit values
|
||||
/* This controls optimization of the reading of 16-bit and 32-bit values
|
||||
* from PNG files. It can be set on a per-app-file basis - it
|
||||
* just changes whether a macro is used when the function is called.
|
||||
* The library builder sets the default; if read functions are not
|
||||
|
@ -480,7 +480,7 @@
|
|||
#if CHAR_BIT == 8 && UCHAR_MAX == 255
|
||||
typedef unsigned char png_byte;
|
||||
#else
|
||||
# error "libpng requires 8 bit bytes"
|
||||
# error "libpng requires 8-bit bytes"
|
||||
#endif
|
||||
|
||||
#if INT_MIN == -32768 && INT_MAX == 32767
|
||||
|
@ -488,7 +488,7 @@
|
|||
#elif SHRT_MIN == -32768 && SHRT_MAX == 32767
|
||||
typedef short png_int_16;
|
||||
#else
|
||||
# error "libpng requires a signed 16 bit type"
|
||||
# error "libpng requires a signed 16-bit type"
|
||||
#endif
|
||||
|
||||
#if UINT_MAX == 65535
|
||||
|
@ -496,7 +496,7 @@
|
|||
#elif USHRT_MAX == 65535
|
||||
typedef unsigned short png_uint_16;
|
||||
#else
|
||||
# error "libpng requires an unsigned 16 bit type"
|
||||
# error "libpng requires an unsigned 16-bit type"
|
||||
#endif
|
||||
|
||||
#if INT_MIN < -2147483646 && INT_MAX > 2147483646
|
||||
|
@ -504,7 +504,7 @@
|
|||
#elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
|
||||
typedef long int png_int_32;
|
||||
#else
|
||||
# error "libpng requires a signed 32 bit (or more) type"
|
||||
# error "libpng requires a signed 32-bit (or more) type"
|
||||
#endif
|
||||
|
||||
#if UINT_MAX > 4294967294
|
||||
|
@ -512,7 +512,7 @@
|
|||
#elif ULONG_MAX > 4294967294
|
||||
typedef unsigned long int png_uint_32;
|
||||
#else
|
||||
# error "libpng requires an unsigned 32 bit (or more) type"
|
||||
# error "libpng requires an unsigned 32-bit (or more) type"
|
||||
#endif
|
||||
|
||||
/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
|
||||
|
|
|
@ -768,7 +768,7 @@ png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
|
|||
|
||||
/* If control reaches this point, png_longjmp() must not return. The only
|
||||
* choice is to terminate the whole process (or maybe the thread); to do
|
||||
* this the ANSI-C abort() function is used unless a different method is
|
||||
* this the ANSI-C abort() function is used unless a different method is
|
||||
* implemented by overriding the default configuration setting for
|
||||
* PNG_ABORT().
|
||||
*/
|
||||
|
|
|
@ -223,7 +223,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|||
/* Storage for unknown chunks that the library doesn't recognize. */
|
||||
png_unknown_chunkp unknown_chunks;
|
||||
|
||||
/* The type of this field is limited by the type of
|
||||
/* The type of this field is limited by the type of
|
||||
* png_struct::user_chunk_cache_max, else overflow can occur.
|
||||
*/
|
||||
int unknown_chunks_num;
|
||||
|
|
|
@ -133,7 +133,7 @@ png_process_some_data(png_structrp png_ptr, png_inforp info_ptr)
|
|||
void /* PRIVATE */
|
||||
png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
|
||||
{
|
||||
png_size_t num_checked = png_ptr->sig_bytes, /* SAFE, does not exceed 8 */
|
||||
png_size_t num_checked = png_ptr->sig_bytes, /* SAFE, does not exceed 8 */
|
||||
num_to_check = 8 - num_checked;
|
||||
|
||||
if (png_ptr->buffer_size < num_to_check)
|
||||
|
@ -563,7 +563,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
|||
* are of different types and we don't know which variable has the fewest
|
||||
* bits. Carefully select the smaller and cast it to the type of the
|
||||
* larger - this cannot overflow. Do not cast in the following test - it
|
||||
* will break on either 16 or 64 bit platforms.
|
||||
* will break on either 16-bit or 64-bit platforms.
|
||||
*/
|
||||
if (idat_size < save_size)
|
||||
save_size = (png_size_t)idat_size;
|
||||
|
@ -662,7 +662,7 @@ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
|
|||
* change the current behavior (see comments in inflate.c
|
||||
* for why this doesn't happen at present with zlib 1.2.5).
|
||||
*/
|
||||
ret = inflate(&png_ptr->zstream, Z_SYNC_FLUSH);
|
||||
ret = PNG_INFLATE(png_ptr, Z_SYNC_FLUSH);
|
||||
|
||||
/* Check for any failure before proceeding. */
|
||||
if (ret != Z_OK && ret != Z_STREAM_END)
|
||||
|
|
|
@ -575,10 +575,6 @@
|
|||
#define PNG_STRUCT_PNG 0x0001
|
||||
#define PNG_STRUCT_INFO 0x0002
|
||||
|
||||
/* Scaling factor for filter heuristic weighting calculations */
|
||||
#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
|
||||
#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
|
||||
|
||||
/* Flags for the png_ptr->flags rather than declaring a byte for each one */
|
||||
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
|
||||
#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002 /* Added to libpng-1.6.0 */
|
||||
|
@ -669,7 +665,7 @@
|
|||
/* The fixed point conversion performs range checking and evaluates
|
||||
* its argument multiple times, so must be used with care. The
|
||||
* range checking uses the PNG specification values for a signed
|
||||
* 32 bit fixed point value except that the values are deliberately
|
||||
* 32-bit fixed point value except that the values are deliberately
|
||||
* rounded-to-zero to an integral value - 21474 (21474.83 is roughly
|
||||
* (2^31-1) * 100000). 's' is a string that describes the value being
|
||||
* converted.
|
||||
|
@ -816,7 +812,7 @@
|
|||
*/
|
||||
#endif
|
||||
|
||||
/* This is used for 16 bit gamma tables -- only the top level pointers are
|
||||
/* This is used for 16-bit gamma tables -- only the top level pointers are
|
||||
* const; this could be changed:
|
||||
*/
|
||||
typedef const png_uint_16p * png_const_uint_16pp;
|
||||
|
@ -1219,6 +1215,14 @@ PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
|
|||
/* Initialize the row buffers, etc. */
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
|
||||
|
||||
#if PNG_ZLIB_VERNUM >= 0x1240
|
||||
PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush),
|
||||
PNG_EMPTY);
|
||||
# define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush)
|
||||
#else /* Zlib < 1.2.4 */
|
||||
# define PNG_INFLATE(pp, flush) inflate(&(pp)->zstream, flush)
|
||||
#endif /* Zlib < 1.2.4 */
|
||||
|
||||
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
||||
/* Optional call to update the users info structure */
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_transform_info,(png_structrp png_ptr,
|
||||
|
|
|
@ -1683,10 +1683,11 @@ decode_gamma(png_image_read_control *display, png_uint_32 value, int encoding)
|
|||
value *= 257;
|
||||
break;
|
||||
|
||||
#ifdef __GNUC__
|
||||
default:
|
||||
png_error(display->image->opaque->png_ptr,
|
||||
"unexpected encoding (internal error)");
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -2837,7 +2838,6 @@ png_image_read_colormap(png_voidp argument)
|
|||
default:
|
||||
png_error(png_ptr, "invalid PNG color type");
|
||||
/*NOT REACHED*/
|
||||
break;
|
||||
}
|
||||
|
||||
/* Now deal with the output processing */
|
||||
|
@ -2847,10 +2847,6 @@ png_image_read_colormap(png_voidp argument)
|
|||
|
||||
switch (data_encoding)
|
||||
{
|
||||
default:
|
||||
png_error(png_ptr, "bad data option (internal error)");
|
||||
break;
|
||||
|
||||
case P_sRGB:
|
||||
/* Change to 8-bit sRGB */
|
||||
png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB);
|
||||
|
@ -2860,6 +2856,11 @@ png_image_read_colormap(png_voidp argument)
|
|||
if (png_ptr->bit_depth > 8)
|
||||
png_set_scale_16(png_ptr);
|
||||
break;
|
||||
|
||||
#ifdef __GNUC__
|
||||
default:
|
||||
png_error(png_ptr, "bad data option (internal error)");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (cmap_entries > 256 || cmap_entries > image->colormap_entries)
|
||||
|
@ -3410,10 +3411,6 @@ png_image_read_background(png_voidp argument)
|
|||
*/
|
||||
switch (info_ptr->bit_depth)
|
||||
{
|
||||
default:
|
||||
png_error(png_ptr, "unexpected bit depth");
|
||||
break;
|
||||
|
||||
case 8:
|
||||
/* 8-bit sRGB gray values with an alpha channel; the alpha channel is
|
||||
* to be removed by composing on a background: either the row if
|
||||
|
@ -3631,6 +3628,11 @@ png_image_read_background(png_voidp argument)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef __GNUC__
|
||||
default:
|
||||
png_error(png_ptr, "unexpected bit depth");
|
||||
#endif
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* reads from a file pointer. Note that this routine sometimes gets called
|
||||
* with very small lengths, so you should implement some kind of simple
|
||||
* buffering if you are using unbuffered reads. This should never be asked
|
||||
* to read more than 64K on a 16 bit machine.
|
||||
* to read more than 64K on a 16-bit machine.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
|
@ -976,7 +976,6 @@ png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
|
|||
|
||||
default:
|
||||
png_error(png_ptr, "invalid error action to rgb_to_gray");
|
||||
break;
|
||||
}
|
||||
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
|
@ -1997,7 +1996,7 @@ png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr)
|
|||
# endif
|
||||
|
||||
# else
|
||||
/* No 16 bit support: force chopping 16-bit input down to 8, in this case
|
||||
/* No 16-bit support: force chopping 16-bit input down to 8, in this case
|
||||
* the app program can chose if both APIs are available by setting the
|
||||
* correct scaling to use.
|
||||
*/
|
||||
|
@ -2098,10 +2097,10 @@ png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr)
|
|||
defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
|
||||
if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
|
||||
{
|
||||
if (info_ptr->bit_depth < png_ptr->user_transform_depth)
|
||||
if (png_ptr->user_transform_depth != 0)
|
||||
info_ptr->bit_depth = png_ptr->user_transform_depth;
|
||||
|
||||
if (info_ptr->channels < png_ptr->user_transform_channels)
|
||||
if (png_ptr->user_transform_channels != 0)
|
||||
info_ptr->channels = png_ptr->user_transform_channels;
|
||||
}
|
||||
#endif
|
||||
|
@ -2382,8 +2381,8 @@ png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
|
|||
|
||||
while (sp < ep)
|
||||
{
|
||||
/* The input is an array of 16 bit components, these must be scaled to
|
||||
* 8 bits each. For a 16 bit value V the required value (from the PNG
|
||||
/* The input is an array of 16-bit components, these must be scaled to
|
||||
* 8 bits each. For a 16-bit value V the required value (from the PNG
|
||||
* specification) is:
|
||||
*
|
||||
* (V * 255) / 65535
|
||||
|
@ -2404,7 +2403,7 @@ png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
|
|||
*
|
||||
* The approximate differs from the exact answer only when (vlo-vhi) is
|
||||
* 128; it then gives a correction of +1 when the exact correction is
|
||||
* 0. This gives 128 errors. The exact answer (correct for all 16 bit
|
||||
* 0. This gives 128 errors. The exact answer (correct for all 16-bit
|
||||
* input values) is:
|
||||
*
|
||||
* error = (vlo-vhi+128)*65535 >> 24;
|
||||
|
@ -3148,9 +3147,9 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
|
|||
if (red != green || red != blue)
|
||||
rgb_error |= 1;
|
||||
|
||||
/* From 1.5.5 in the 16 bit case do the accurate conversion even
|
||||
/* From 1.5.5 in the 16-bit case do the accurate conversion even
|
||||
* in the 'fast' case - this is because this is where the code
|
||||
* ends up when handling linear 16 bit data.
|
||||
* ends up when handling linear 16-bit data.
|
||||
*/
|
||||
gray16 = (png_uint_16)((rc*red + gc*green + bc*blue + 16384) >>
|
||||
15);
|
||||
|
@ -3315,7 +3314,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||
if ((png_uint_16)((*sp >> shift) & 0x0f)
|
||||
== png_ptr->trans_color.gray)
|
||||
{
|
||||
unsigned int tmp = *sp & (0xf0f >> (4 - shift));
|
||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||
tmp |= png_ptr->background.gray << shift;
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
|
@ -3325,7 +3324,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||
unsigned int p = (*sp >> shift) & 0x0f;
|
||||
unsigned int g = (gamma_table[p | (p << 4)] >> 4) &
|
||||
0x0f;
|
||||
unsigned int tmp = *sp & (0xf0f >> (4 - shift));
|
||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||
tmp |= g << shift;
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
|
@ -3351,7 +3350,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||
if ((png_uint_16)((*sp >> shift) & 0x0f)
|
||||
== png_ptr->trans_color.gray)
|
||||
{
|
||||
unsigned int tmp = *sp & (0xf0f >> (4 - shift));
|
||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||
tmp |= png_ptr->background.gray << shift;
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Last changed in libpng 1.6.20 [December 3, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
|
@ -89,7 +89,13 @@ png_get_int_32)(png_const_bytep buf)
|
|||
return uval;
|
||||
|
||||
uval = (uval ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */
|
||||
return -(png_int_32)uval;
|
||||
if ((uval & 0x80000000) == 0) /* no overflow */
|
||||
return -(png_int_32)uval;
|
||||
/* The following has to be safe; this function only gets called on PNG data
|
||||
* and if we get here that data is invalid. 0 is the most safe value and
|
||||
* if not then an attacker would surely just generate a PNG with 0 instead.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Grab an unsigned 16-bit integer from a buffer in big-endian format. */
|
||||
|
@ -98,7 +104,7 @@ png_get_uint_16)(png_const_bytep buf)
|
|||
{
|
||||
/* ANSI-C requires an int value to accomodate at least 16 bits so this
|
||||
* works and allows the compiler not to worry about possible narrowing
|
||||
* on 32 bit systems. (Pre-ANSI systems did not make integers smaller
|
||||
* on 32-bit systems. (Pre-ANSI systems did not make integers smaller
|
||||
* than 16 bits either.)
|
||||
*/
|
||||
unsigned int val =
|
||||
|
@ -371,10 +377,16 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
|||
|
||||
if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) ==
|
||||
PNG_OPTION_ON)
|
||||
{
|
||||
window_bits = 15;
|
||||
png_ptr->zstream_start = 0; /* fixed window size */
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
window_bits = 0;
|
||||
png_ptr->zstream_start = 1;
|
||||
}
|
||||
# else
|
||||
# define window_bits 0
|
||||
# endif
|
||||
|
@ -423,6 +435,31 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if PNG_ZLIB_VERNUM >= 0x1240
|
||||
/* Handle the start of the inflate stream if we called inflateInit2(strm,0);
|
||||
* in this case some zlib versions skip validation of the CINFO field and, in
|
||||
* certain circumstances, libpng may end up displaying an invalid image, in
|
||||
* contrast to implementations that call zlib in the normal way (e.g. libpng
|
||||
* 1.5).
|
||||
*/
|
||||
int /* PRIVATE */
|
||||
png_zlib_inflate(png_structrp png_ptr, int flush)
|
||||
{
|
||||
if (png_ptr->zstream_start && png_ptr->zstream.avail_in > 0)
|
||||
{
|
||||
if ((*png_ptr->zstream.next_in >> 4) > 7)
|
||||
{
|
||||
png_ptr->zstream.msg = "invalid window size (libpng)";
|
||||
return Z_DATA_ERROR;
|
||||
}
|
||||
|
||||
png_ptr->zstream_start = 0;
|
||||
}
|
||||
|
||||
return inflate(&png_ptr->zstream, flush);
|
||||
}
|
||||
#endif /* Zlib >= 1.2.4 */
|
||||
|
||||
#ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED
|
||||
/* png_inflate now returns zlib error codes including Z_OK and Z_STREAM_END to
|
||||
* allow the caller to do multiple calls if required. If the 'finish' flag is
|
||||
|
@ -516,7 +553,7 @@ png_inflate(png_structrp png_ptr, png_uint_32 owner, int finish,
|
|||
* the previous chunk of input data. Tell zlib if we have reached the
|
||||
* end of the output buffer.
|
||||
*/
|
||||
ret = inflate(&png_ptr->zstream, avail_out > 0 ? Z_NO_FLUSH :
|
||||
ret = PNG_INFLATE(png_ptr, avail_out > 0 ? Z_NO_FLUSH :
|
||||
(finish ? Z_FINISH : Z_SYNC_FLUSH));
|
||||
} while (ret == Z_OK);
|
||||
|
||||
|
@ -765,7 +802,7 @@ png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size,
|
|||
* the available output is produced; this allows reading of truncated
|
||||
* streams.
|
||||
*/
|
||||
ret = inflate(&png_ptr->zstream,
|
||||
ret = PNG_INFLATE(png_ptr,
|
||||
*chunk_bytes > 0 ? Z_NO_FLUSH : (finish ? Z_FINISH : Z_SYNC_FLUSH));
|
||||
}
|
||||
while (ret == Z_OK && (*out_size > 0 || png_ptr->zstream.avail_out > 0));
|
||||
|
@ -866,7 +903,7 @@ void /* PRIVATE */
|
|||
png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
{
|
||||
png_color palette[PNG_MAX_PALETTE_LENGTH];
|
||||
int num, i;
|
||||
int max_palette_length, num, i;
|
||||
#ifdef PNG_POINTER_INDEXING_SUPPORTED
|
||||
png_colorp pal_ptr;
|
||||
#endif
|
||||
|
@ -927,6 +964,19 @@ png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
/* The cast is safe because 'length' is less than 3*PNG_MAX_PALETTE_LENGTH */
|
||||
num = (int)length / 3;
|
||||
|
||||
/* If the palette has 256 or fewer entries but is too large for the bit
|
||||
* depth, we don't issue an error, to preserve the behavior of previous
|
||||
* libpng versions. We silently truncate the unused extra palette entries
|
||||
* here.
|
||||
*/
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
max_palette_length = (1 << png_ptr->bit_depth);
|
||||
else
|
||||
max_palette_length = PNG_MAX_PALETTE_LENGTH;
|
||||
|
||||
if (num > max_palette_length)
|
||||
num = max_palette_length;
|
||||
|
||||
#ifdef PNG_POINTER_INDEXING_SUPPORTED
|
||||
for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
|
||||
{
|
||||
|
@ -959,7 +1009,7 @@ png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
#endif
|
||||
{
|
||||
png_crc_finish(png_ptr, 0);
|
||||
png_crc_finish(png_ptr, (int) length - num * 3);
|
||||
}
|
||||
|
||||
#ifndef PNG_READ_OPT_PLTE_SUPPORTED
|
||||
|
@ -1651,7 +1701,7 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
++entry_start;
|
||||
|
||||
/* A sample depth should follow the separator, and we should be on it */
|
||||
if (entry_start > buffer + length - 2)
|
||||
if (length < 2U || entry_start > buffer + (length - 2U))
|
||||
{
|
||||
png_warning(png_ptr, "malformed sPLT chunk");
|
||||
return;
|
||||
|
@ -1818,7 +1868,7 @@ png_handle_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
return;
|
||||
}
|
||||
|
||||
if (length > png_ptr->num_palette ||
|
||||
if (length > (unsigned int) png_ptr->num_palette ||
|
||||
length > (unsigned int) PNG_MAX_PALETTE_LENGTH ||
|
||||
length == 0)
|
||||
{
|
||||
|
@ -1982,7 +2032,8 @@ png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
|
||||
num = length / 2 ;
|
||||
|
||||
if (num != png_ptr->num_palette || num > (unsigned int) PNG_MAX_PALETTE_LENGTH)
|
||||
if (num != (unsigned int) png_ptr->num_palette ||
|
||||
num > (unsigned int) PNG_MAX_PALETTE_LENGTH)
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
png_chunk_benign_error(png_ptr, "invalid");
|
||||
|
@ -2154,7 +2205,7 @@ png_handle_pCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
/* We need to have at least 12 bytes after the purpose string
|
||||
* in order to get the parameter information.
|
||||
*/
|
||||
if (endptr <= buf + 12)
|
||||
if (endptr - buf <= 12)
|
||||
{
|
||||
png_chunk_benign_error(png_ptr, "invalid");
|
||||
return;
|
||||
|
@ -4019,7 +4070,7 @@ png_read_IDAT_data(png_structrp png_ptr, png_bytep output,
|
|||
*
|
||||
* TODO: deal more elegantly with truncated IDAT lists.
|
||||
*/
|
||||
ret = inflate(&png_ptr->zstream, Z_NO_FLUSH);
|
||||
ret = PNG_INFLATE(png_ptr, Z_NO_FLUSH);
|
||||
|
||||
/* Take the unconsumed output back. */
|
||||
if (output != NULL)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
|
@ -123,12 +123,12 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
|
|||
png_fixed(png_ptr, red_X, "cHRM Red X"),
|
||||
png_fixed(png_ptr, red_Y, "cHRM Red Y"),
|
||||
png_fixed(png_ptr, red_Z, "cHRM Red Z"),
|
||||
png_fixed(png_ptr, green_X, "cHRM Red X"),
|
||||
png_fixed(png_ptr, green_Y, "cHRM Red Y"),
|
||||
png_fixed(png_ptr, green_Z, "cHRM Red Z"),
|
||||
png_fixed(png_ptr, blue_X, "cHRM Red X"),
|
||||
png_fixed(png_ptr, blue_Y, "cHRM Red Y"),
|
||||
png_fixed(png_ptr, blue_Z, "cHRM Red Z"));
|
||||
png_fixed(png_ptr, green_X, "cHRM Green X"),
|
||||
png_fixed(png_ptr, green_Y, "cHRM Green Y"),
|
||||
png_fixed(png_ptr, green_Z, "cHRM Green Z"),
|
||||
png_fixed(png_ptr, blue_X, "cHRM Blue X"),
|
||||
png_fixed(png_ptr, blue_Y, "cHRM Blue Y"),
|
||||
png_fixed(png_ptr, blue_Z, "cHRM Blue Z"));
|
||||
}
|
||||
# endif /* FLOATING_POINT */
|
||||
|
||||
|
@ -513,12 +513,17 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
|
|||
png_const_colorp palette, int num_palette)
|
||||
{
|
||||
|
||||
png_uint_32 max_palette_length;
|
||||
|
||||
png_debug1(1, "in %s storage function", "PLTE");
|
||||
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (num_palette < 0 || num_palette > PNG_MAX_PALETTE_LENGTH)
|
||||
max_palette_length = (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
|
||||
(1 << info_ptr->bit_depth) : PNG_MAX_PALETTE_LENGTH;
|
||||
|
||||
if (num_palette < 0 || num_palette > (int) max_palette_length)
|
||||
{
|
||||
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
png_error(png_ptr, "Invalid palette length");
|
||||
|
@ -551,8 +556,8 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
|
|||
png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
|
||||
|
||||
/* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
|
||||
* of num_palette entries, in case of an invalid PNG file that has
|
||||
* too-large sample values.
|
||||
* of num_palette entries, in case of an invalid PNG file or incorrect
|
||||
* call to png_set_PLTE() with too-large sample values.
|
||||
*/
|
||||
png_ptr->palette = png_voidcast(png_colorp, png_calloc(png_ptr,
|
||||
PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))));
|
||||
|
@ -709,7 +714,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
{
|
||||
int i;
|
||||
|
||||
png_debug1(1, "in %lx storage function", png_ptr == NULL ? 0xabadca11 :
|
||||
png_debug1(1, "in %lx storage function", png_ptr == NULL ? 0xabadca11U :
|
||||
(unsigned long)png_ptr->chunk_name);
|
||||
|
||||
if (png_ptr == NULL || info_ptr == NULL || num_text <= 0 || text_ptr == NULL)
|
||||
|
@ -1568,7 +1573,7 @@ png_set_user_limits (png_structrp png_ptr, png_uint_32 user_width_max,
|
|||
{
|
||||
/* Images with dimensions larger than these limits will be
|
||||
* rejected by png_set_IHDR(). To accept any PNG datastream
|
||||
* regardless of dimensions, set both limits to 0x7ffffffL.
|
||||
* regardless of dimensions, set both limits to 0x7fffffff.
|
||||
*/
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
|
|
@ -263,6 +263,9 @@ struct png_struct_def
|
|||
/* pixel depth used for the row buffers */
|
||||
png_byte transformed_pixel_depth;
|
||||
/* pixel depth after read/write transforms */
|
||||
#if PNG_ZLIB_VERNUM >= 0x1240
|
||||
png_byte zstream_start; /* at start of an input zlib stream */
|
||||
#endif /* Zlib >= 1.2.4 */
|
||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||
png_uint_16 filler; /* filler bytes for pixel expansion */
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@ png_set_bgr(png_structrp png_ptr)
|
|||
#endif
|
||||
|
||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||
/* Turn on 16 bit byte swapping */
|
||||
/* Turn on 16-bit byte swapping */
|
||||
void PNGAPI
|
||||
png_set_swap(png_structrp png_ptr)
|
||||
{
|
||||
|
@ -313,7 +313,7 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
|||
|
||||
#ifdef PNG_16BIT_SUPPORTED
|
||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||
/* Swaps byte order on 16 bit depth images */
|
||||
/* Swaps byte order on 16-bit depth images */
|
||||
void /* PRIVATE */
|
||||
png_do_swap(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* writes to a file pointer. Note that this routine sometimes gets called
|
||||
* with very small lengths, so you should implement some kind of simple
|
||||
* buffering if you are using unbuffered writes. This should never be asked
|
||||
* to write more than 64K on a 16 bit machine.
|
||||
* to write more than 64K on a 16-bit machine.
|
||||
*/
|
||||
|
||||
void /* PRIVATE */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
|
@ -206,7 +206,7 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr)
|
|||
png_write_PLTE(png_ptr, info_ptr->palette,
|
||||
(png_uint_32)info_ptr->num_palette);
|
||||
|
||||
else if ((info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) !=0)
|
||||
else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
png_error(png_ptr, "Valid palette required for paletted images");
|
||||
|
||||
#ifdef PNG_WRITE_tRNS_SUPPORTED
|
||||
|
@ -1422,7 +1422,7 @@ png_write_png(png_structrp png_ptr, png_inforp info_ptr,
|
|||
png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ENDIAN not supported");
|
||||
#endif
|
||||
|
||||
/* Swap bits of 1, 2, 4 bit packed pixel formats */
|
||||
/* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats */
|
||||
if ((transforms & PNG_TRANSFORM_PACKSWAP) != 0)
|
||||
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
|
||||
png_set_packswap(png_ptr);
|
||||
|
@ -1998,7 +1998,7 @@ png_image_write_main(png_voidp argument)
|
|||
/* Now set up the data transformations (*after* the header is written),
|
||||
* remove the handled transformations from the 'format' flags for checking.
|
||||
*
|
||||
* First check for a little endian system if writing 16 bit files.
|
||||
* First check for a little endian system if writing 16-bit files.
|
||||
*/
|
||||
if (write_16bit != 0)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 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.)
|
||||
|
@ -179,7 +179,7 @@ png_write_complete_chunk(png_structrp png_ptr, png_uint_32 chunk_name,
|
|||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
/* On 64 bit architectures 'length' may not fit in a png_uint_32. */
|
||||
/* On 64-bit architectures 'length' may not fit in a png_uint_32. */
|
||||
if (length > PNG_UINT_31_MAX)
|
||||
png_error(png_ptr, "length exceeds PNG maximum");
|
||||
|
||||
|
@ -922,17 +922,20 @@ void /* PRIVATE */
|
|||
png_write_PLTE(png_structrp png_ptr, png_const_colorp palette,
|
||||
png_uint_32 num_pal)
|
||||
{
|
||||
png_uint_32 i;
|
||||
png_uint_32 max_palette_length, i;
|
||||
png_const_colorp pal_ptr;
|
||||
png_byte buf[3];
|
||||
|
||||
png_debug(1, "in png_write_PLTE");
|
||||
|
||||
max_palette_length = (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
|
||||
(1 << png_ptr->bit_depth) : PNG_MAX_PALETTE_LENGTH;
|
||||
|
||||
if ((
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0 &&
|
||||
#endif
|
||||
num_pal == 0) || num_pal > 256)
|
||||
num_pal == 0) || num_pal > max_palette_length)
|
||||
{
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
{
|
||||
|
@ -1444,7 +1447,7 @@ png_write_tRNS(png_structrp png_ptr, png_const_bytep trans_alpha,
|
|||
|
||||
else if (color_type == PNG_COLOR_TYPE_GRAY)
|
||||
{
|
||||
/* One 16 bit value */
|
||||
/* One 16-bit value */
|
||||
if (tran->gray >= (1 << png_ptr->bit_depth))
|
||||
{
|
||||
png_app_warning(png_ptr,
|
||||
|
@ -1459,7 +1462,7 @@ png_write_tRNS(png_structrp png_ptr, png_const_bytep trans_alpha,
|
|||
|
||||
else if (color_type == PNG_COLOR_TYPE_RGB)
|
||||
{
|
||||
/* Three 16 bit values */
|
||||
/* Three 16-bit values */
|
||||
png_save_uint_16(buf, tran->red);
|
||||
png_save_uint_16(buf + 2, tran->green);
|
||||
png_save_uint_16(buf + 4, tran->blue);
|
||||
|
@ -2560,7 +2563,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||
if (filter_to_do == PNG_FILTER_SUB)
|
||||
/* It's the only filter so no testing is needed */
|
||||
{
|
||||
(void) png_setup_sub_row(png_ptr, bpp, row_bytes, mins);
|
||||
(void) png_setup_sub_row(png_ptr, bpp, row_bytes, mins);
|
||||
best_row = png_ptr->try_row;
|
||||
}
|
||||
|
||||
|
@ -2569,7 +2572,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||
png_size_t sum;
|
||||
png_size_t lmins = mins;
|
||||
|
||||
sum = png_setup_sub_row(png_ptr, bpp, row_bytes, lmins);
|
||||
sum = png_setup_sub_row(png_ptr, bpp, row_bytes, lmins);
|
||||
|
||||
if (sum < mins)
|
||||
{
|
||||
|
@ -2595,7 +2598,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||
png_size_t sum;
|
||||
png_size_t lmins = mins;
|
||||
|
||||
sum = png_setup_up_row(png_ptr, row_bytes, lmins);
|
||||
sum = png_setup_up_row(png_ptr, row_bytes, lmins);
|
||||
|
||||
if (sum < mins)
|
||||
{
|
||||
|
@ -2651,7 +2654,6 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||
|
||||
if (sum < mins)
|
||||
{
|
||||
mins = sum;
|
||||
best_row = png_ptr->try_row;
|
||||
if (png_ptr->tst_row != NULL)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue