[master] Imported from libpng-1.6.21.tar
This commit is contained in:
parent
047737496a
commit
5756fcab2f
64
ANNOUNCE
64
ANNOUNCE
@ -1,4 +1,4 @@
|
||||
Libpng 1.6.20 - December 3, 2015
|
||||
Libpng 1.6.21 - January 15, 2016
|
||||
|
||||
This is a public release of libpng, intended for use in production codes.
|
||||
|
||||
@ -7,41 +7,49 @@ Files available for download:
|
||||
Source files with LF line endings (for Unix/Linux) and with a
|
||||
"configure" script
|
||||
|
||||
libpng-1.6.20.tar.xz (LZMA-compressed, recommended)
|
||||
libpng-1.6.20.tar.gz
|
||||
libpng-1.6.21.tar.xz (LZMA-compressed, recommended)
|
||||
libpng-1.6.21.tar.gz
|
||||
|
||||
Source files with CRLF line endings (for Windows), without the
|
||||
"configure" script
|
||||
|
||||
/scratch/glennrp/Libpng16/lpng1620.7z (LZMA-compressed, recommended)
|
||||
/scratch/glennrp/Libpng16/lpng1620.zip
|
||||
/scratch/glennrp/Libpng16/lpng1621.7z (LZMA-compressed, recommended)
|
||||
/scratch/glennrp/Libpng16/lpng1621.zip
|
||||
|
||||
Other information:
|
||||
|
||||
libpng-1.6.20-README.txt
|
||||
libpng-1.6.20-LICENSE.txt
|
||||
libpng-1.6.20-*.asc (armored detached GPG signatures)
|
||||
libpng-1.6.21-README.txt
|
||||
libpng-1.6.21-LICENSE.txt
|
||||
libpng-1.6.21-*.asc (armored detached GPG signatures)
|
||||
|
||||
Changes since the last public release (1.6.19):
|
||||
Avoid potential pointer overflow/underflow in png_handle_sPLT() and
|
||||
png_handle_pCAL() (Bug report by John Regehr).
|
||||
Fixed incorrect implementation of png_set_PLTE() that uses png_ptr
|
||||
not info_ptr, that left png_set_PLTE() open to the CVE-2015-8126
|
||||
vulnerability.
|
||||
Backported tests from libpng-1.7.0beta69.
|
||||
Fixed an error in handling of bad zlib CMINFO field in pngfix, found by
|
||||
American Fuzzy Lop, reported by Brian Carpenter. inflate() doesn't
|
||||
immediately fault a bad CMINFO field; instead a 'too far back' error
|
||||
happens later (at least some times). pngfix failed to limit CMINFO to
|
||||
the allowed values but then assumed that window_bits was in range,
|
||||
triggering an assert. The bug is mostly harmless; the PNG file cannot
|
||||
be fixed.
|
||||
In libpng 1.6 zlib initialization was changed to use the window size
|
||||
in the zlib stream, not a fixed value. This causes some invalid images,
|
||||
where CINFO is too large, to display 'correctly' if the rest of the
|
||||
data is valid. This provides a workaround for zlib versions where the
|
||||
error arises (ones that support the API change to use the window size
|
||||
in the stream).
|
||||
Changes since the last public release (1.6.20):
|
||||
|
||||
Fixed syntax "$(command)" in tests/pngstest that some shells other than
|
||||
bash could not parse (Bug report by Nelson Beebe). Use `command` instead.
|
||||
Moved png_check_keyword() from pngwutil.c to pngset.c
|
||||
Removed LE/BE dependencies in pngvalid, to 'fix' the current problem
|
||||
in the BigEndian tests by not testing it, making the BE code the same
|
||||
as the LE version.
|
||||
Fixes to pngvalid for various reduced build configurations (eliminate unused
|
||||
statics) and a fix for the case in rgb_to_gray when the digitize option
|
||||
reduces graylo to 0, producing a large error.
|
||||
Widened the 'limit' check on the internally calculated error limits in
|
||||
the 'DIGITIZE' case (the code used prior to 1.7 for rgb_to_gray error
|
||||
checks) and changed the check to only operate in non-release builds
|
||||
(base build type not RC or RELEASE.)
|
||||
Fixed undefined behavior in pngvalid.c, undefined because
|
||||
(png_byte) << shift is undefined if it changes the signed bit
|
||||
(because png_byte is promoted to int). The libpng exported functions
|
||||
png_get_uint_32 and png_get_uint_16 handle this. (Bug reported by
|
||||
David Drysdale as a result of reports from UBSAN in clang 3.8).
|
||||
This changes pngvalid to use BE random numbers; this used to produce
|
||||
errors but these should not be fixed as a result of the previous changes.
|
||||
In projects/vstudio, combined readme.txt and WARNING into README.txt
|
||||
Relocated assert() in contrib/tools/pngfix.c, bug found by American
|
||||
Fuzzy Lop, reported by Brian Carpenter.
|
||||
Marked 'limit' UNUSED in transform_range_check(). This only affects
|
||||
release builds.
|
||||
Worked around a false-positive Coverity issue in pngvalid.c.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
40
CHANGES
40
CHANGES
@ -5421,7 +5421,7 @@ Version 1.6.20beta01 [November 20, 2015]
|
||||
Version 1.6.20beta02 [November 23, 2015]
|
||||
Fixed incorrect implementation of png_set_PLTE() that uses png_ptr
|
||||
not info_ptr, that left png_set_PLTE() open to the CVE-2015-8126
|
||||
vulnerability.
|
||||
vulnerability. Fixes CVE-2015-8472.
|
||||
|
||||
Version 1.6.20beta03 [November 24, 2015]
|
||||
Backported tests from libpng-1.7.0beta69.
|
||||
@ -5446,6 +5446,44 @@ Version 1.6.20rc02 [November 29, 2015]
|
||||
Version 1.6.20 [December 3, 2015]
|
||||
No changes.
|
||||
|
||||
Version 1.6.21beta01 [December 11, 2015]
|
||||
Fixed syntax "$(command)" in tests/pngstest that some shells other than
|
||||
bash could not parse (Bug report by Nelson Beebe). Use `command` instead.
|
||||
|
||||
Version 1.6.21beta02 [December 14, 2015]
|
||||
Moved png_check_keyword() from pngwutil.c to pngset.c
|
||||
Removed LE/BE dependencies in pngvalid, to 'fix' the current problem
|
||||
in the BigEndian tests by not testing it, making the BE code the same
|
||||
as the LE version.
|
||||
Fixes to pngvalid for various reduced build configurations (eliminate unused
|
||||
statics) and a fix for the case in rgb_to_gray when the digitize option
|
||||
reduces graylo to 0, producing a large error.
|
||||
|
||||
Version 1.6.21beta03 [December 18, 2015]
|
||||
Widened the 'limit' check on the internally calculated error limits in
|
||||
the 'DIGITIZE' case (the code used prior to 1.7 for rgb_to_gray error
|
||||
checks) and changed the check to only operate in non-release builds
|
||||
(base build type not RC or RELEASE.)
|
||||
Fixed undefined behavior in pngvalid.c, undefined because
|
||||
(png_byte) << shift is undefined if it changes the signed bit
|
||||
(because png_byte is promoted to int). The libpng exported functions
|
||||
png_get_uint_32 and png_get_uint_16 handle this. (Bug reported by
|
||||
David Drysdale as a result of reports from UBSAN in clang 3.8).
|
||||
This changes pngvalid to use BE random numbers; this used to produce
|
||||
errors but these should not be fixed as a result of the previous changes.
|
||||
|
||||
Version 1.6.21rc01 [January 4, 2016]
|
||||
In projects/vstudio, combined readme.txt and WARNING into README.txt
|
||||
|
||||
Version 1.6.21rc02 [January 7, 2016]
|
||||
Relocated assert() in contrib/tools/pngfix.c, bug found by American
|
||||
Fuzzy Lop, reported by Brian Carpenter.
|
||||
Marked 'limit' UNUSED in transform_range_check(). This only affects
|
||||
release builds.
|
||||
|
||||
Version 1.6.21 [January 15, 2016]
|
||||
Worked around a false-positive Coverity issue in pngvalid.c.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
|
@ -16,7 +16,7 @@ enable_testing()
|
||||
|
||||
set(PNGLIB_MAJOR 1)
|
||||
set(PNGLIB_MINOR 6)
|
||||
set(PNGLIB_RELEASE 20)
|
||||
set(PNGLIB_RELEASE 21)
|
||||
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
||||
|
||||
@ -261,7 +261,7 @@ endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
# SET UP LINKS
|
||||
if(PNG_SHARED)
|
||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.20
|
||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.21
|
||||
VERSION 16.${PNGLIB_RELEASE}.0
|
||||
SOVERSION 16
|
||||
CLEAN_DIRECT_OUTPUT 1)
|
||||
|
6
LICENSE
6
LICENSE
@ -10,8 +10,8 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
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
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.6.21, January 15, 2016, are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2016 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:
|
||||
@ -109,4 +109,4 @@ the additional disclaimers inserted at version 1.0.7.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
December 3, 2015
|
||||
January 15, 2016
|
||||
|
2
README
2
README
@ -1,4 +1,4 @@
|
||||
README for libpng version 1.6.20 - December 3, 2015 (shared library 16.0)
|
||||
README for libpng version 1.6.21 - January 15, 2016 (shared library 16.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
|
@ -18,7 +18,7 @@ AC_PREREQ([2.68])
|
||||
|
||||
dnl Version number stuff here:
|
||||
|
||||
AC_INIT([libpng],[1.6.20],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_INIT([libpng],[1.6.21],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_CONFIG_MACRO_DIR([scripts])
|
||||
|
||||
# libpng does not follow GNU file name conventions (hence 'foreign')
|
||||
@ -39,10 +39,10 @@ dnl automake, so the following is not necessary (and is not defined anyway):
|
||||
dnl AM_PREREQ([1.11.2])
|
||||
dnl stop configure from automagically running automake
|
||||
|
||||
PNGLIB_VERSION=1.6.20
|
||||
PNGLIB_VERSION=1.6.21
|
||||
PNGLIB_MAJOR=1
|
||||
PNGLIB_MINOR=6
|
||||
PNGLIB_RELEASE=20
|
||||
PNGLIB_RELEASE=21
|
||||
|
||||
dnl End of version number stuff
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
/* Copyright: */
|
||||
#define COPYRIGHT "\251 2013,2015 John Cunningham Bowler"
|
||||
/*
|
||||
* Last changed in libpng 1.7.0 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.20 [November 24, 2015]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2013-2015 John Cunningham Bowler
|
||||
*
|
||||
* Last changed in libpng 1.6.19 [(PENDING RELEASE)]
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngvalid.c - validate libpng by constructing then reading png files.
|
||||
*
|
||||
* Last changed in libpng 1.5.25 [December 3, 2015]
|
||||
* Copyright (c) 2014-2015 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.21 [January 15, 2016]
|
||||
* Copyright (c) 2014-2016 Glenn Randers-Pehrson
|
||||
* Written by John Cunningham Bowler
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
@ -116,6 +116,16 @@ typedef png_byte *png_const_bytep;
|
||||
# define png_const_structp png_structp
|
||||
#endif
|
||||
|
||||
#ifndef RELEASE_BUILD
|
||||
/* RELEASE_BUILD is true for releases and release candidates: */
|
||||
# define RELEASE_BUILD (PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC)
|
||||
#endif
|
||||
#if RELEASE_BUILD
|
||||
# define debugonly(something)
|
||||
#else /* !RELEASE_BUILD */
|
||||
# define debugonly(something) something
|
||||
#endif /* !RELEASE_BUILD */
|
||||
|
||||
#include <float.h> /* For floating point constants */
|
||||
#include <stdlib.h> /* For malloc */
|
||||
#include <string.h> /* For memcpy, memset */
|
||||
@ -276,7 +286,8 @@ make_four_random_bytes(png_uint_32* seed, png_bytep bytes)
|
||||
make_random_bytes(seed, bytes, 4);
|
||||
}
|
||||
|
||||
#if defined PNG_READ_SUPPORTED || defined PNG_WRITE_tRNS_SUPPORTED
|
||||
#if defined PNG_READ_SUPPORTED || defined PNG_WRITE_tRNS_SUPPORTED ||\
|
||||
defined PNG_WRITE_FILTER_SUPPORTED
|
||||
static void
|
||||
randomize(void *pv, size_t size)
|
||||
{
|
||||
@ -284,19 +295,66 @@ randomize(void *pv, size_t size)
|
||||
make_random_bytes(random_seed, pv, size);
|
||||
}
|
||||
|
||||
#define RANDOMIZE(this) randomize(&(this), sizeof (this))
|
||||
#endif /* READ || WRITE_tRNS */
|
||||
#define R8(this) randomize(&(this), sizeof (this))
|
||||
|
||||
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
||||
static void r16(png_uint_16p p16, size_t count)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i=0; i<count; ++i)
|
||||
{
|
||||
unsigned char b2[2];
|
||||
randomize(b2, sizeof b2);
|
||||
*p16++ = png_get_uint_16(b2);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __COVERITY__
|
||||
# define R16(this)\
|
||||
r16(&(this), (sizeof (this))/2U/*(sizeof (png_uint_16))*/)
|
||||
#else
|
||||
# define R16(this)\
|
||||
r16(&(this), (sizeof (this))/(sizeof (png_uint_16)))
|
||||
#endif
|
||||
|
||||
#if defined PNG_READ_RGB_TO_GRAY_SUPPORTED ||\
|
||||
defined PNG_READ_FILLER_SUPPORTED
|
||||
static void r32(png_uint_32p p32, size_t count)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i=0; i<count; ++i)
|
||||
{
|
||||
unsigned char b4[4];
|
||||
randomize(b4, sizeof b4);
|
||||
*p32++ = png_get_uint_32(b4);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __COVERITY__
|
||||
# define R32(this)\
|
||||
r32(&(this), (sizeof (this))/4U/*(sizeof (png_uint_32))*/)
|
||||
#else
|
||||
# define R32(this)\
|
||||
r32(&(this), (sizeof (this))/(sizeof (png_uint_32)))
|
||||
#endif
|
||||
|
||||
#endif /* READ_FILLER || READ_RGB_TO_GRAY */
|
||||
|
||||
#endif /* READ || WRITE_tRNS || WRITE_FILTER */
|
||||
|
||||
#if defined PNG_READ_TRANSFORMS_SUPPORTED ||\
|
||||
defined PNG_WRITE_FILTER_SUPPORTED
|
||||
static unsigned int
|
||||
random_mod(unsigned int max)
|
||||
{
|
||||
unsigned int x;
|
||||
png_uint_16 x;
|
||||
|
||||
RANDOMIZE(x);
|
||||
R16(x);
|
||||
|
||||
return x % max; /* 0 .. max-1 */
|
||||
}
|
||||
#endif /* READ_TRANSFORMS || WRITE_FILTER */
|
||||
|
||||
#if (defined PNG_READ_RGB_TO_GRAY_SUPPORTED) ||\
|
||||
(defined PNG_READ_FILLER_SUPPORTED)
|
||||
@ -305,12 +363,11 @@ random_choice(void)
|
||||
{
|
||||
unsigned char x;
|
||||
|
||||
RANDOMIZE(x);
|
||||
R8(x);
|
||||
|
||||
return x & 1;
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
#endif /* READ_RGB_TO_GRAY || READ_FILLER */
|
||||
|
||||
/* A numeric ID based on PNG file characteristics. The 'do_interlace' field
|
||||
* simply records whether pngvalid did the interlace itself or whether it
|
||||
@ -1974,6 +2031,8 @@ typedef struct png_modifier
|
||||
* internal check on pngvalid to ensure that the calculated error limits are
|
||||
* not ridiculous; without this it is too easy to make a mistake in pngvalid
|
||||
* that allows any value through.
|
||||
*
|
||||
* NOTE: this is not checked in release builds.
|
||||
*/
|
||||
double limit; /* limit on error values, normally 4E-3 */
|
||||
|
||||
@ -3278,12 +3337,14 @@ set_random_tRNS(png_structp pp, png_infop pi, const png_byte colour_type,
|
||||
png_color_16 tRNS;
|
||||
const png_uint_16 mask = (png_uint_16)((1U << bit_depth)-1);
|
||||
|
||||
RANDOMIZE(tRNS);
|
||||
R8(tRNS); /* makes unset fields random */
|
||||
|
||||
if (colour_type & 2/*RGB*/)
|
||||
{
|
||||
if (bit_depth == 8)
|
||||
{
|
||||
R16(tRNS.red);
|
||||
R16(tRNS.green);
|
||||
tRNS.blue = tRNS.red ^ tRNS.green;
|
||||
tRNS.red &= mask;
|
||||
tRNS.green &= mask;
|
||||
@ -3292,13 +3353,17 @@ set_random_tRNS(png_structp pp, png_infop pi, const png_byte colour_type,
|
||||
|
||||
else /* bit_depth == 16 */
|
||||
{
|
||||
R16(tRNS.red);
|
||||
tRNS.green = (png_uint_16)(tRNS.red * 257);
|
||||
tRNS.blue = (png_uint_16)(tRNS.green * 17);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
R16(tRNS.gray);
|
||||
tRNS.gray &= mask;
|
||||
}
|
||||
|
||||
png_set_tRNS(pp, pi, NULL, 0, &tRNS);
|
||||
}
|
||||
@ -3649,6 +3714,28 @@ deinterlace_row(png_bytep buffer, png_const_bytep row,
|
||||
* layout details. See make_size_images below for a way to make images
|
||||
* that test odd sizes along with the libpng interlace handling.
|
||||
*/
|
||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||
static void
|
||||
choose_random_filter(png_structp pp, int start)
|
||||
{
|
||||
/* Choose filters randomly except that on the very first row ensure that
|
||||
* there is at least one previous row filter.
|
||||
*/
|
||||
int filters = PNG_ALL_FILTERS & random_mod(256U);
|
||||
|
||||
/* There may be no filters; skip the setting. */
|
||||
if (filters != 0)
|
||||
{
|
||||
if (start && filters < PNG_FILTER_UP)
|
||||
filters |= PNG_FILTER_UP;
|
||||
|
||||
png_set_filter(pp, 0/*method*/, filters);
|
||||
}
|
||||
}
|
||||
#else /* !WRITE_FILTER */
|
||||
# define choose_random_filter(pp, start) ((void)0)
|
||||
#endif /* !WRITE_FILTER */
|
||||
|
||||
static void
|
||||
make_transform_image(png_store* const ps, png_byte const colour_type,
|
||||
png_byte const bit_depth, unsigned int palette_number,
|
||||
@ -3767,6 +3854,7 @@ make_transform_image(png_store* const ps, png_byte const colour_type,
|
||||
}
|
||||
# endif /* do_own_interlace */
|
||||
|
||||
choose_random_filter(pp, pass == 0 && y == 0);
|
||||
png_write_row(pp, buffer);
|
||||
}
|
||||
}
|
||||
@ -3943,9 +4031,6 @@ make_size_image(png_store* const ps, png_byte const colour_type,
|
||||
int npasses = npasses_from_interlace_type(pp, interlace_type);
|
||||
png_uint_32 y;
|
||||
int pass;
|
||||
# ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||
int nfilter = PNG_FILTER_VALUE_LAST;
|
||||
# endif
|
||||
png_byte image[16][SIZE_ROWMAX];
|
||||
|
||||
/* To help consistent error detection make the parts of this buffer
|
||||
@ -4008,15 +4093,19 @@ make_size_image(png_store* const ps, png_byte const colour_type,
|
||||
* does accept a filter number (per the spec) as well as a bit
|
||||
* mask.
|
||||
*
|
||||
* The apparent wackiness of decrementing nfilter rather than
|
||||
* incrementing is so that Paeth gets used in all images bigger
|
||||
* than 1 row - it's the tricky one.
|
||||
* The code now uses filters at random, except that on the first
|
||||
* row of an image it ensures that a previous row filter is in
|
||||
* the set so that libpng allocates the row buffer.
|
||||
*/
|
||||
png_set_filter(pp, 0/*method*/,
|
||||
nfilter >= PNG_FILTER_VALUE_LAST ? PNG_ALL_FILTERS : nfilter);
|
||||
{
|
||||
int filters = 8 << random_mod(PNG_FILTER_VALUE_LAST);
|
||||
|
||||
if (nfilter-- == 0)
|
||||
nfilter = PNG_FILTER_VALUE_LAST-1;
|
||||
if (pass == 0 && y == 0 &&
|
||||
(filters < PNG_FILTER_UP || w == 1U))
|
||||
filters |= PNG_FILTER_UP;
|
||||
|
||||
png_set_filter(pp, 0/*method*/, filters);
|
||||
}
|
||||
# endif
|
||||
|
||||
png_write_row(pp, row);
|
||||
@ -4244,62 +4333,71 @@ make_error(png_store* const ps, png_byte const colour_type,
|
||||
#undef exception__env
|
||||
|
||||
/* And clear these flags */
|
||||
ps->expect_error = 0;
|
||||
ps->expect_warning = 0;
|
||||
|
||||
/* Now write the whole image, just to make sure that the detected, or
|
||||
* undetected, errro has not created problems inside libpng.
|
||||
*/
|
||||
if (png_get_rowbytes(pp, pi) !=
|
||||
transform_rowsize(pp, colour_type, bit_depth))
|
||||
png_error(pp, "row size incorrect");
|
||||
if (ps->expect_error)
|
||||
ps->expect_error = 0;
|
||||
|
||||
else
|
||||
{
|
||||
int npasses = set_write_interlace_handling(pp, interlace_type);
|
||||
int pass;
|
||||
/* Now write the whole image, just to make sure that the detected, or
|
||||
* undetected, errro has not created problems inside libpng. This
|
||||
* doesn't work if there was a png_error in png_write_info because that
|
||||
* can abort before PLTE was written.
|
||||
*/
|
||||
if (png_get_rowbytes(pp, pi) !=
|
||||
transform_rowsize(pp, colour_type, bit_depth))
|
||||
png_error(pp, "row size incorrect");
|
||||
|
||||
if (npasses != npasses_from_interlace_type(pp, interlace_type))
|
||||
png_error(pp, "write: png_set_interlace_handling failed");
|
||||
|
||||
for (pass=0; pass<npasses; ++pass)
|
||||
else
|
||||
{
|
||||
png_uint_32 y;
|
||||
int npasses = set_write_interlace_handling(pp, interlace_type);
|
||||
int pass;
|
||||
|
||||
for (y=0; y<h; ++y)
|
||||
if (npasses != npasses_from_interlace_type(pp, interlace_type))
|
||||
png_error(pp, "write: png_set_interlace_handling failed");
|
||||
|
||||
for (pass=0; pass<npasses; ++pass)
|
||||
{
|
||||
png_byte buffer[TRANSFORM_ROWMAX];
|
||||
png_uint_32 y;
|
||||
|
||||
transform_row(pp, buffer, colour_type, bit_depth, y);
|
||||
for (y=0; y<h; ++y)
|
||||
{
|
||||
png_byte buffer[TRANSFORM_ROWMAX];
|
||||
|
||||
# if do_own_interlace
|
||||
/* If do_own_interlace *and* the image is interlaced we need a
|
||||
* reduced interlace row; this may be reduced to empty.
|
||||
*/
|
||||
if (interlace_type == PNG_INTERLACE_ADAM7)
|
||||
{
|
||||
/* The row must not be written if it doesn't exist, notice
|
||||
* that there are two conditions here, either the row isn't
|
||||
* ever in the pass or the row would be but isn't wide
|
||||
* enough to contribute any pixels. In fact the wPass test
|
||||
* can be used to skip the whole y loop in this case.
|
||||
transform_row(pp, buffer, colour_type, bit_depth, y);
|
||||
|
||||
# if do_own_interlace
|
||||
/* If do_own_interlace *and* the image is interlaced we
|
||||
* need a reduced interlace row; this may be reduced to
|
||||
* empty.
|
||||
*/
|
||||
if (PNG_ROW_IN_INTERLACE_PASS(y, pass) &&
|
||||
PNG_PASS_COLS(w, pass) > 0)
|
||||
interlace_row(buffer, buffer,
|
||||
bit_size(pp, colour_type, bit_depth), w, pass,
|
||||
0/*data always bigendian*/);
|
||||
else
|
||||
continue;
|
||||
}
|
||||
# endif /* do_own_interlace */
|
||||
if (interlace_type == PNG_INTERLACE_ADAM7)
|
||||
{
|
||||
/* The row must not be written if it doesn't exist,
|
||||
* notice that there are two conditions here, either the
|
||||
* row isn't ever in the pass or the row would be but
|
||||
* isn't wide enough to contribute any pixels. In fact
|
||||
* the wPass test can be used to skip the whole y loop
|
||||
* in this case.
|
||||
*/
|
||||
if (PNG_ROW_IN_INTERLACE_PASS(y, pass) &&
|
||||
PNG_PASS_COLS(w, pass) > 0)
|
||||
interlace_row(buffer, buffer,
|
||||
bit_size(pp, colour_type, bit_depth), w, pass,
|
||||
0/*data always bigendian*/);
|
||||
else
|
||||
continue;
|
||||
}
|
||||
# endif /* do_own_interlace */
|
||||
|
||||
png_write_row(pp, buffer);
|
||||
png_write_row(pp, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* image writing */
|
||||
|
||||
png_write_end(pp, pi);
|
||||
png_write_end(pp, pi);
|
||||
}
|
||||
|
||||
/* The following deletes the file that was just written. */
|
||||
store_write_reset(ps);
|
||||
@ -6257,7 +6355,7 @@ transform_range_check(png_const_structp pp, unsigned int r, unsigned int g,
|
||||
unsigned int max = (1U<<sample_depth)-1;
|
||||
double in_min = ceil((in-err)*max - digitization_error);
|
||||
double in_max = floor((in+err)*max + digitization_error);
|
||||
if (err > limit || !(out >= in_min && out <= in_max))
|
||||
if (debugonly(err > limit ||) !(out >= in_min && out <= in_max))
|
||||
{
|
||||
char message[256];
|
||||
size_t pos;
|
||||
@ -6283,6 +6381,8 @@ transform_range_check(png_const_structp pp, unsigned int r, unsigned int g,
|
||||
|
||||
png_error(pp, message);
|
||||
}
|
||||
|
||||
UNUSED(limit)
|
||||
}
|
||||
|
||||
static void
|
||||
@ -7213,7 +7313,7 @@ image_transform_png_set_rgb_to_gray_ini(const image_transform *this,
|
||||
png_uint_32 ru;
|
||||
double total;
|
||||
|
||||
RANDOMIZE(ru);
|
||||
R32(ru);
|
||||
data.green_coefficient = total = (ru & 0xffff) / 65535.;
|
||||
ru >>= 16;
|
||||
data.red_coefficient = (1 - total) * (ru & 0xffff) / 65535.;
|
||||
@ -7274,14 +7374,12 @@ image_transform_png_set_rgb_to_gray_ini(const image_transform *this,
|
||||
* When DIGITIZE is set because a pre-1.7 version of libpng is being
|
||||
* tested allow a bigger slack.
|
||||
*
|
||||
* NOTE: this magic number was determined by experiment to be about
|
||||
* 1.263. There's no great merit to the value below, however it only
|
||||
* affects the limit used for checking for internal calculation errors,
|
||||
* not the actual limit imposed by pngvalid on the output errors.
|
||||
* NOTE: this number only affects the internal limit check in pngvalid,
|
||||
* it has no effect on the limits applied to the libpng values.
|
||||
*/
|
||||
that->pm->limit += pow(
|
||||
# if DIGITIZE
|
||||
1.3
|
||||
2.0
|
||||
# else
|
||||
1.0
|
||||
# endif
|
||||
@ -7443,7 +7541,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||
/* Image now has RGB channels... */
|
||||
# if DIGITIZE
|
||||
{
|
||||
const png_modifier *pm = display->pm;
|
||||
png_modifier *pm = display->pm;
|
||||
const unsigned int sample_depth = that->sample_depth;
|
||||
const unsigned int calc_depth = (pm->assume_16_bit_calculations ? 16 :
|
||||
sample_depth);
|
||||
@ -7592,9 +7690,11 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||
else
|
||||
{
|
||||
err = fabs(grayhi-gray);
|
||||
|
||||
if (fabs(gray - graylo) > err)
|
||||
err = fabs(graylo-gray);
|
||||
|
||||
#if !RELEASE_BUILD
|
||||
/* Check that this worked: */
|
||||
if (err > pm->limit)
|
||||
{
|
||||
@ -7605,11 +7705,13 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||
pos = safecatd(buffer, sizeof buffer, pos, err, 6);
|
||||
pos = safecat(buffer, sizeof buffer, pos, " exceeds limit ");
|
||||
pos = safecatd(buffer, sizeof buffer, pos, pm->limit, 6);
|
||||
png_error(pp, buffer);
|
||||
png_warning(pp, buffer);
|
||||
pm->limit = err;
|
||||
}
|
||||
#endif /* !RELEASE_BUILD */
|
||||
}
|
||||
}
|
||||
# else /* DIGITIZE */
|
||||
# else /* !DIGITIZE */
|
||||
{
|
||||
double r = that->redf;
|
||||
double re = that->rede;
|
||||
@ -7668,7 +7770,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||
* lookups in the calculation and each introduces a quantization
|
||||
* error defined by the table size.
|
||||
*/
|
||||
const png_modifier *pm = display->pm;
|
||||
png_modifier *pm = display->pm;
|
||||
double in_qe = (that->sample_depth > 8 ? .5/65535 : .5/255);
|
||||
double out_qe = (that->sample_depth > 8 ? .5/65535 :
|
||||
(pm->assume_16_bit_calculations ? .5/(1<<display->max_gamma_8) :
|
||||
@ -7718,6 +7820,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||
else
|
||||
err -= in_qe;
|
||||
|
||||
#if !RELEASE_BUILD
|
||||
/* Validate that the error is within limits (this has caused
|
||||
* problems before, it's much easier to detect them here.)
|
||||
*/
|
||||
@ -7730,8 +7833,10 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||
pos = safecatd(buffer, sizeof buffer, pos, err, 6);
|
||||
pos = safecat(buffer, sizeof buffer, pos, " exceeds limit ");
|
||||
pos = safecatd(buffer, sizeof buffer, pos, pm->limit, 6);
|
||||
png_error(pp, buffer);
|
||||
png_warning(pp, buffer);
|
||||
pm->limit = err;
|
||||
}
|
||||
#endif /* !RELEASE_BUILD */
|
||||
}
|
||||
}
|
||||
# endif /* !DIGITIZE */
|
||||
@ -7802,7 +7907,7 @@ image_transform_png_set_background_set(const image_transform *this,
|
||||
* so we need to know what that is! The background colour is stored in the
|
||||
* transform_display.
|
||||
*/
|
||||
RANDOMIZE(random_bytes);
|
||||
R8(random_bytes);
|
||||
|
||||
/* Read the random value, for colour type 3 the background colour is actually
|
||||
* expressed as a 24bit rgb, not an index.
|
||||
@ -7830,7 +7935,7 @@ image_transform_png_set_background_set(const image_transform *this,
|
||||
/* Extract the background colour from this image_pixel, but make sure the
|
||||
* unused fields of 'back' are garbage.
|
||||
*/
|
||||
RANDOMIZE(back);
|
||||
R8(back);
|
||||
|
||||
if (colour_type & PNG_COLOR_MASK_COLOR)
|
||||
{
|
||||
@ -8136,7 +8241,7 @@ image_transform_png_set_filler_set(const image_transform *this,
|
||||
* filler. The 'filler' value has all 32 bits set, but only bit_depth
|
||||
* will be used. At this point we don't know bit_depth.
|
||||
*/
|
||||
RANDOMIZE(data.filler);
|
||||
R32(data.filler);
|
||||
data.flags = random_choice();
|
||||
|
||||
png_set_filler(pp, data.filler, data.flags);
|
||||
@ -8209,7 +8314,7 @@ image_transform_png_set_add_alpha_set(const image_transform *this,
|
||||
* filler. The 'filler' value has all 32 bits set, but only bit_depth
|
||||
* will be used. At this point we don't know bit_depth.
|
||||
*/
|
||||
RANDOMIZE(data.filler);
|
||||
R32(data.filler);
|
||||
data.flags = random_choice();
|
||||
|
||||
png_set_add_alpha(pp, data.filler, data.flags);
|
||||
@ -11296,6 +11401,9 @@ int main(int argc, char **argv)
|
||||
|
||||
else if (strcmp(*argv, "-w") == 0 ||
|
||||
strcmp(*argv, "--strict") == 0)
|
||||
pm.this.treat_warnings_as_errors = 1; /* NOTE: this is the default! */
|
||||
|
||||
else if (strcmp(*argv, "--nostrict") == 0)
|
||||
pm.this.treat_warnings_as_errors = 0;
|
||||
|
||||
else if (strcmp(*argv, "--speed") == 0)
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* pngfix.c
|
||||
*
|
||||
* Copyright (c) 2014-2015 John Cunningham Bowler
|
||||
* Copyright (c) 2014-2016 John Cunningham Bowler
|
||||
*
|
||||
* Last changed in libpng 1.6.20 [December 3, 2015]
|
||||
* Last changed in libpng 1.6.21 [January 15, 2016]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@ -319,13 +319,13 @@ uarb_mult32(uarb acc, int a_digits, uarb num, int n_digits, png_uint_32 val)
|
||||
a_digits = uarb_mult_digit(acc, a_digits, num, n_digits,
|
||||
(png_uint_16)(val & 0xffff));
|
||||
|
||||
/* Because n_digits and val are >0 the following must be true: */
|
||||
assert(a_digits > 0);
|
||||
|
||||
val >>= 16;
|
||||
if (val > 0)
|
||||
a_digits = uarb_mult_digit(acc+1, a_digits-1, num, n_digits,
|
||||
(png_uint_16)val) + 1;
|
||||
|
||||
/* Because n_digits and val are >0 the following must be true: */
|
||||
assert(a_digits > 0);
|
||||
}
|
||||
|
||||
return a_digits;
|
||||
|
@ -1,9 +1,9 @@
|
||||
libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.6.20 - December 3, 2015
|
||||
libpng version 1.6.21 - January 15, 2016
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||
|
||||
This document is released under the libpng license.
|
||||
For conditions of distribution and use, see the disclaimer
|
||||
@ -11,9 +11,9 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.6.20 - December 3, 2015
|
||||
libpng versions 0.97, January 1998, through 1.6.21 - January 15, 2016
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||
|
||||
libpng 1.0 beta 6 - version 0.96 - May 28, 1997
|
||||
Updated and distributed by Andreas Dilger
|
||||
@ -5078,6 +5078,10 @@ 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 gray profile or a
|
||||
three-tracer-curve RGB profile as appropriate.
|
||||
|
||||
Libpng 1.5.x erroneously used /MD for Debug DLL builds; if you used the debug
|
||||
builds in your app and you changed your app to use /MD you will need to
|
||||
change it back to /MDd for libpng 1.6.x.
|
||||
|
||||
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
|
||||
are allowed by the PNG specification, so these warnings are no longer issued.
|
||||
@ -5324,7 +5328,7 @@ 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.20 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.6.21 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
|
||||
|
28
libpng.3
28
libpng.3
@ -1,6 +1,6 @@
|
||||
.TH LIBPNG 3 "December 3, 2015"
|
||||
.TH LIBPNG 3 "January 15, 2016"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.20
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.21
|
||||
.SH SYNOPSIS
|
||||
\fB
|
||||
#include <png.h>\fP
|
||||
@ -508,10 +508,10 @@ 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.20 - December 3, 2015
|
||||
libpng version 1.6.21 - January 15, 2016
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||
|
||||
This document is released under the libpng license.
|
||||
For conditions of distribution and use, see the disclaimer
|
||||
@ -519,9 +519,9 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.6.20 - December 3, 2015
|
||||
libpng versions 0.97, January 1998, through 1.6.21 - January 15, 2016
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||
|
||||
libpng 1.0 beta 6 - version 0.96 - May 28, 1997
|
||||
Updated and distributed by Andreas Dilger
|
||||
@ -5586,6 +5586,10 @@ 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 gray profile or a
|
||||
three-tracer-curve RGB profile as appropriate.
|
||||
|
||||
Libpng 1.5.x erroneously used /MD for Debug DLL builds; if you used the debug
|
||||
builds in your app and you changed your app to use /MD you will need to
|
||||
change it back to /MDd for libpng 1.6.x.
|
||||
|
||||
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
|
||||
are allowed by the PNG specification, so these warnings are no longer issued.
|
||||
@ -5832,7 +5836,7 @@ 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.20 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.6.21 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
|
||||
@ -5934,7 +5938,7 @@ the first widely used release:
|
||||
...
|
||||
1.5.23 15 10523 15.so.15.23[.0]
|
||||
...
|
||||
1.6.20 16 10620 16.so.16.20[.0]
|
||||
1.6.21 16 10621 16.so.16.21[.0]
|
||||
|
||||
Henceforth the source version will match the shared-library minor
|
||||
and patch numbers; the shared-library major version number will be
|
||||
@ -5990,7 +5994,7 @@ possible without all of you.
|
||||
|
||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
|
||||
Libpng version 1.6.20 - December 3, 2015:
|
||||
Libpng version 1.6.21 - January 15, 2016:
|
||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
||||
|
||||
@ -6015,8 +6019,8 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
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
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.6.21, January 15, 2016, are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2016 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:
|
||||
@ -6114,7 +6118,7 @@ the additional disclaimers inserted at version 1.0.7.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
December 3, 2015
|
||||
January 15, 2016
|
||||
|
||||
.\" end of man page
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
.TH LIBPNGPF 3 "December 3, 2015"
|
||||
.TH LIBPNGPF 3 "January 15, 2016"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.20
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.21
|
||||
(private functions)
|
||||
.SH SYNOPSIS
|
||||
\fB#include \fI"pngpriv.h"
|
||||
|
2
png.5
2
png.5
@ -1,4 +1,4 @@
|
||||
.TH PNG 5 "December 3, 2015"
|
||||
.TH PNG 5 "January 15, 2016"
|
||||
.SH NAME
|
||||
png \- Portable Network Graphics (PNG) format
|
||||
.SH DESCRIPTION
|
||||
|
13
png.c
13
png.c
@ -2,7 +2,7 @@
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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_20 Your_png_h_is_not_version_1_6_20;
|
||||
typedef png_libpng_version_1_6_21 Your_png_h_is_not_version_1_6_21;
|
||||
|
||||
/* 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
|
||||
@ -775,14 +775,15 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.20 - December 3, 2015" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.21 - January 15, 2016" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2002,2004,2006-2016 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.20 - December 3, 2015\
|
||||
Copyright (c) 1998-2015 Glenn Randers-Pehrson\
|
||||
return "libpng version 1.6.21 - January 15, 2016\
|
||||
Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
# endif
|
||||
|
26
png.h
26
png.h
@ -1,9 +1,9 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.20, December 3, 2015
|
||||
* libpng version 1.6.21, January 15, 2016
|
||||
*
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 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.)
|
||||
*
|
||||
@ -12,7 +12,7 @@
|
||||
* 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.20, December 3, 2015:
|
||||
* libpng versions 0.97, January 1998, through 1.6.21, January 15, 2016:
|
||||
* Glenn Randers-Pehrson.
|
||||
* See also "Contributing Authors", below.
|
||||
*/
|
||||
@ -25,8 +25,8 @@
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* 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
|
||||
* libpng versions 1.0.7, July 1, 2000, through 1.6.21, January 15, 2016, are
|
||||
* Copyright (c) 2000-2002, 2004, 2006-2016 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:
|
||||
@ -186,7 +186,7 @@
|
||||
* ...
|
||||
* 1.5.23 15 10523 15.so.15.23[.0]
|
||||
* ...
|
||||
* 1.6.20 16 10620 16.so.16.20[.0]
|
||||
* 1.6.21 16 10621 16.so.16.21[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@ -214,13 +214,13 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* December 3, 2015
|
||||
* January 15, 2016
|
||||
*
|
||||
* 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.20 are Y2K compliant. It is my belief that
|
||||
* upward through 1.6.21 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
|
||||
@ -282,9 +282,9 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.20"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.21"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.6.20 - December 3, 2015\n"
|
||||
" libpng version 1.6.21 - January 15, 2016\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
@ -292,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 20
|
||||
#define PNG_LIBPNG_VER_RELEASE 21
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
@ -323,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 10620 /* 1.6.20 */
|
||||
#define PNG_LIBPNG_VER 10621 /* 1.6.21 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
@ -433,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_20;
|
||||
typedef char* png_libpng_version_1_6_21;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.20, December 3, 2015
|
||||
* libpng version 1.6.21, January 15, 2016
|
||||
*
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
|
||||
*
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-2013 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.)
|
||||
*
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
|
2
pngget.c
2
pngget.c
@ -2,7 +2,7 @@
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* pnginfo.h - header file for PNG reference library
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-2013 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.)
|
||||
*
|
||||
|
2
pngmem.c
2
pngmem.c
@ -2,7 +2,7 @@
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.21 [January 15, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
@ -1917,6 +1917,9 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
|
||||
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
|
||||
png_const_charp key, png_bytep new_key), PNG_EMPTY);
|
||||
|
||||
/* Maintainer: Put new private prototypes here ^ */
|
||||
|
||||
#include "pngdebug.h"
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
|
2
pngrio.c
2
pngrio.c
@ -2,7 +2,7 @@
|
||||
/* pngrio.c - functions for data input
|
||||
*
|
||||
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.20 [December 3, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.20 [December 3, 2014]
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
|
86
pngset.c
86
pngset.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Last changed in libpng 1.6.21 [January 15, 2016]
|
||||
* 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.)
|
||||
@ -1644,4 +1644,88 @@ png_set_check_for_invalid_index(png_structrp png_ptr, int allowed)
|
||||
png_ptr->num_palette_max = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_TEXT_SUPPORTED) || defined(PNG_pCAL_SUPPORTED) || \
|
||||
defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
|
||||
/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification,
|
||||
* and if invalid, correct the keyword rather than discarding the entire
|
||||
* chunk. The PNG 1.0 specification requires keywords 1-79 characters in
|
||||
* length, forbids leading or trailing whitespace, multiple internal spaces,
|
||||
* and the non-break space (0x80) from ISO 8859-1. Returns keyword length.
|
||||
*
|
||||
* The 'new_key' buffer must be 80 characters in size (for the keyword plus a
|
||||
* trailing '\0'). If this routine returns 0 then there was no keyword, or a
|
||||
* valid one could not be generated, and the caller must png_error.
|
||||
*/
|
||||
png_uint_32 /* PRIVATE */
|
||||
png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
||||
{
|
||||
png_const_charp orig_key = key;
|
||||
png_uint_32 key_len = 0;
|
||||
int bad_character = 0;
|
||||
int space = 1;
|
||||
|
||||
png_debug(1, "in png_check_keyword");
|
||||
|
||||
if (key == NULL)
|
||||
{
|
||||
*new_key = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (*key && key_len < 79)
|
||||
{
|
||||
png_byte ch = (png_byte)*key++;
|
||||
|
||||
if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
|
||||
*new_key++ = ch, ++key_len, space = 0;
|
||||
|
||||
else if (space == 0)
|
||||
{
|
||||
/* A space or an invalid character when one wasn't seen immediately
|
||||
* before; output just a space.
|
||||
*/
|
||||
*new_key++ = 32, ++key_len, space = 1;
|
||||
|
||||
/* If the character was not a space then it is invalid. */
|
||||
if (ch != 32)
|
||||
bad_character = ch;
|
||||
}
|
||||
|
||||
else if (bad_character == 0)
|
||||
bad_character = ch; /* just skip it, record the first error */
|
||||
}
|
||||
|
||||
if (key_len > 0 && space != 0) /* trailing space */
|
||||
{
|
||||
--key_len, --new_key;
|
||||
if (bad_character == 0)
|
||||
bad_character = 32;
|
||||
}
|
||||
|
||||
/* Terminate the keyword */
|
||||
*new_key = 0;
|
||||
|
||||
if (key_len == 0)
|
||||
return 0;
|
||||
|
||||
#ifdef PNG_WARNINGS_SUPPORTED
|
||||
/* Try to only output one warning per keyword: */
|
||||
if (*key != 0) /* keyword too long */
|
||||
png_warning(png_ptr, "keyword truncated");
|
||||
|
||||
else if (bad_character != 0)
|
||||
{
|
||||
PNG_WARNING_PARAMETERS(p)
|
||||
|
||||
png_warning_parameter(p, 1, orig_key);
|
||||
png_warning_parameter_signed(p, 2, PNG_NUMBER_FORMAT_02x, bad_character);
|
||||
|
||||
png_formatted_warning(png_ptr, p, "keyword \"@1\": bad character '0x@2'");
|
||||
}
|
||||
#endif /* WARNINGS */
|
||||
|
||||
return key_len;
|
||||
}
|
||||
#endif /* TEXT || pCAL || iCCP || sPLT */
|
||||
#endif /* READ || WRITE */
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* pngstruct.h - header file for PNG reference library
|
||||
*
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* pngtest.c - a simple test program to test libpng
|
||||
*
|
||||
* Last changed in libpng 1.5.25 [December 3, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
@ -2070,4 +2070,4 @@ main(void)
|
||||
#endif
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_20 Your_png_h_is_not_version_1_6_20;
|
||||
typedef png_libpng_version_1_6_21 Your_png_h_is_not_version_1_6_21;
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
|
2
pngwio.c
2
pngwio.c
@ -2,7 +2,7 @@
|
||||
/* pngwio.c - functions for data output
|
||||
*
|
||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||
*
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
|
88
pngwutil.c
88
pngwutil.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.19 [November 12, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.21 [January 15, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-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.)
|
||||
*
|
||||
@ -665,90 +665,6 @@ png_write_compressed_data_out(png_structrp png_ptr, compression_state *comp)
|
||||
}
|
||||
#endif /* WRITE_COMPRESSED_TEXT */
|
||||
|
||||
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
|
||||
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
|
||||
/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification,
|
||||
* and if invalid, correct the keyword rather than discarding the entire
|
||||
* chunk. The PNG 1.0 specification requires keywords 1-79 characters in
|
||||
* length, forbids leading or trailing whitespace, multiple internal spaces,
|
||||
* and the non-break space (0x80) from ISO 8859-1. Returns keyword length.
|
||||
*
|
||||
* The 'new_key' buffer must be 80 characters in size (for the keyword plus a
|
||||
* trailing '\0'). If this routine returns 0 then there was no keyword, or a
|
||||
* valid one could not be generated, and the caller must png_error.
|
||||
*/
|
||||
static png_uint_32
|
||||
png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
||||
{
|
||||
png_const_charp orig_key = key;
|
||||
png_uint_32 key_len = 0;
|
||||
int bad_character = 0;
|
||||
int space = 1;
|
||||
|
||||
png_debug(1, "in png_check_keyword");
|
||||
|
||||
if (key == NULL)
|
||||
{
|
||||
*new_key = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (*key && key_len < 79)
|
||||
{
|
||||
png_byte ch = (png_byte)*key++;
|
||||
|
||||
if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
|
||||
*new_key++ = ch, ++key_len, space = 0;
|
||||
|
||||
else if (space == 0)
|
||||
{
|
||||
/* A space or an invalid character when one wasn't seen immediately
|
||||
* before; output just a space.
|
||||
*/
|
||||
*new_key++ = 32, ++key_len, space = 1;
|
||||
|
||||
/* If the character was not a space then it is invalid. */
|
||||
if (ch != 32)
|
||||
bad_character = ch;
|
||||
}
|
||||
|
||||
else if (bad_character == 0)
|
||||
bad_character = ch; /* just skip it, record the first error */
|
||||
}
|
||||
|
||||
if (key_len > 0 && space != 0) /* trailing space */
|
||||
{
|
||||
--key_len, --new_key;
|
||||
if (bad_character == 0)
|
||||
bad_character = 32;
|
||||
}
|
||||
|
||||
/* Terminate the keyword */
|
||||
*new_key = 0;
|
||||
|
||||
if (key_len == 0)
|
||||
return 0;
|
||||
|
||||
#ifdef PNG_WARNINGS_SUPPORTED
|
||||
/* Try to only output one warning per keyword: */
|
||||
if (*key != 0) /* keyword too long */
|
||||
png_warning(png_ptr, "keyword truncated");
|
||||
|
||||
else if (bad_character != 0)
|
||||
{
|
||||
PNG_WARNING_PARAMETERS(p)
|
||||
|
||||
png_warning_parameter(p, 1, orig_key);
|
||||
png_warning_parameter_signed(p, 2, PNG_NUMBER_FORMAT_02x, bad_character);
|
||||
|
||||
png_formatted_warning(png_ptr, p, "keyword \"@1\": bad character '0x@2'");
|
||||
}
|
||||
#endif /* WARNINGS */
|
||||
|
||||
return key_len;
|
||||
}
|
||||
#endif /* WRITE_TEXT || WRITE_pCAL || WRITE_iCCP || WRITE_sPLT */
|
||||
|
||||
/* Write the IHDR chunk, and update the png_struct with the necessary
|
||||
* information. Note that the rest of this code depends upon this
|
||||
* information being correct.
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
VisualStudio instructions
|
||||
|
||||
libpng version 1.6.20 - December 3, 2015
|
||||
libpng version 1.6.21 - January 15, 2016
|
||||
|
||||
Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
Copyright (c) 2010,2013,2015 Glenn Randers-Pehrson
|
||||
|
||||
This code is released under the libpng license.
|
||||
For conditions of distribution and use, see the disclaimer
|
||||
@ -38,16 +38,17 @@ In particular the runtime library is the "MultiThreaded DLL" version.
|
||||
If you use Visual Studio defaults to build your application you will have no
|
||||
problems.
|
||||
|
||||
If you don't use the Visual Studio defaults your application must still be built
|
||||
with the default runtime option (/MD). If, for some reason, it is not then your
|
||||
application will crash inside libpng16.dll as soon as libpng tries to read
|
||||
from a file handle you pass in.
|
||||
If you don't use the Visual Studio defaults your application must still be
|
||||
built with the default runtime option (/MD). If, for some reason, it is not
|
||||
then your application will crash inside libpng16.dll as soon as libpng
|
||||
tries to read from a file handle you pass in.
|
||||
|
||||
If you do not want to use the DLL, for example for a very small application,
|
||||
the 'release library' configuration may be more appropriate. This is built
|
||||
with a non-standard runtime library - the "MultiThreaded" version. When you
|
||||
build your application it must be compiled with this option (/MT), otherwise
|
||||
it will not build (if you are lucky) or crash (if you are not.)
|
||||
it will not build (if you are lucky) or crash (if you are not.) See the
|
||||
WARNING file that is distributed along with this readme.txt.
|
||||
|
||||
Stop reading here
|
||||
=================
|
||||
@ -63,3 +64,32 @@ track down.)
|
||||
|
||||
The debug build of libpng is minimally supported. Support for debug builds of
|
||||
zlib is also minimal. You really don't want to do this.
|
||||
|
||||
WARNING
|
||||
=======
|
||||
Libpng 1.6.x does not use the default run-time library when building static
|
||||
library builds of libpng; instead of the shared DLL runtime it uses a static
|
||||
runtime. If you need to change this make sure to change the setting on all the
|
||||
relevant projects:
|
||||
|
||||
libpng
|
||||
zlib
|
||||
all the test programs
|
||||
|
||||
The runtime library settings for each build are as follows:
|
||||
|
||||
Release Debug
|
||||
DLL /MD /MDd
|
||||
Library /MT /MTd
|
||||
|
||||
NOTICE that libpng 1.5.x erroneously used /MD for Debug DLL builds; if you used
|
||||
the debug builds in your app and you changed your app to use /MD you will need
|
||||
to change it back to /MDd for libpng 1.6.0 and later.
|
||||
|
||||
The Visual Studio 2010 defaults for a Win32 DLL or Static Library project are
|
||||
as follows:
|
||||
|
||||
Release Debug
|
||||
DLL /MD /MDd
|
||||
Static Library /MD /MDd
|
||||
|
@ -1,27 +0,0 @@
|
||||
WARNING
|
||||
=======
|
||||
Libpng 1.6 does not use the default run-time library when building static
|
||||
library builds of libpng; instead of the shared DLL runtime it uses a static
|
||||
runtime. If you need to change this make sure to change the setting on all the
|
||||
relevant projects:
|
||||
|
||||
libpng
|
||||
zlib
|
||||
all the test programs
|
||||
|
||||
The runtime library settings for each build are as follows:
|
||||
|
||||
Release Debug
|
||||
DLL /MD /MDd
|
||||
Library /MT /MTd
|
||||
|
||||
NOTICE that libpng 1.5 erroneously used /MD for Debug DLL builds; if you used
|
||||
the debug builds in your app and you changed your app to use /MD you will need
|
||||
to change it to /MDd for libpng 1.6.
|
||||
|
||||
The Visual Studio 2010 defaults for a Win32 DLL or Static Library project are
|
||||
as follows:
|
||||
|
||||
Release Debug
|
||||
DLL /MD /MDd
|
||||
Static Library /MD /MDd
|
@ -2,7 +2,7 @@
|
||||
<!--
|
||||
* zlib.props - location of zlib source
|
||||
*
|
||||
* libpng version 1.6.20 - December 3, 2015
|
||||
* libpng version 1.6.21 - January 15, 2016
|
||||
*
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
*
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
Makefiles for libpng version 1.6.20 - December 3, 2015
|
||||
Makefiles for libpng version 1.6.21 - January 15, 2016
|
||||
|
||||
pnglibconf.h.prebuilt => Stores configuration settings
|
||||
makefile.linux => Linux/ELF makefile
|
||||
(gcc, creates libpng16.so.16.1.6.20)
|
||||
(gcc, creates libpng16.so.16.1.6.21)
|
||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||
ansi2knr (Requires ansi2knr.c from
|
||||
@ -33,12 +33,12 @@ pnglibconf.h.prebuilt => Stores configuration settings
|
||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
makefile.sggcc => Silicon Graphics (gcc,
|
||||
creates libpng16.so.16.1.6.20)
|
||||
creates libpng16.so.16.1.6.21)
|
||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||
makefile.solaris => Solaris 2.X makefile (gcc,
|
||||
creates libpng16.so.16.1.6.20)
|
||||
creates libpng16.so.16.1.6.21)
|
||||
makefile.so9 => Solaris 9 makefile (gcc,
|
||||
creates libpng16.so.16.1.6.20)
|
||||
creates libpng16.so.16.1.6.21)
|
||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||
|
@ -21,7 +21,7 @@ PNG_DFN "OS2 DESCRIPTION "PNG image compression library""
|
||||
PNG_DFN "OS2 CODE PRELOAD MOVEABLE DISCARDABLE"
|
||||
PNG_DFN ""
|
||||
PNG_DFN "EXPORTS"
|
||||
PNG_DFN ";Version 1.6.20"
|
||||
PNG_DFN ";Version 1.6.21"
|
||||
|
||||
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\
|
||||
PNG_DFN "@" SYMBOL_PREFIX "@@" name "@"
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
# Modeled after libxml-config.
|
||||
|
||||
version=1.6.20
|
||||
version=1.6.21
|
||||
prefix=""
|
||||
libdir=""
|
||||
libs=""
|
||||
|
@ -5,6 +5,6 @@ includedir=@includedir@/libpng16
|
||||
|
||||
Name: libpng
|
||||
Description: Loads and saves PNG files
|
||||
Version: 1.6.20
|
||||
Version: 1.6.21
|
||||
Libs: -L${libdir} -lpng16
|
||||
Cflags: -I${includedir}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
VERMAJ = 1
|
||||
VERMIN = 6
|
||||
VERMIC = 20
|
||||
VERMIC = 21
|
||||
VER = $(VERMAJ).$(VERMIN).$(VERMIC)
|
||||
NAME = libpng
|
||||
PACKAGE = $(NAME)-$(VER)
|
||||
|
@ -10,7 +10,7 @@
|
||||
# Library name:
|
||||
LIBNAME = libpng16
|
||||
PNGMAJ = 16
|
||||
RELEASE = 20
|
||||
RELEASE = 21
|
||||
|
||||
# Shared library names:
|
||||
LIBSO=$(LIBNAME).so
|
||||
|
@ -18,7 +18,7 @@ exec_prefix=$(prefix)
|
||||
# Library name:
|
||||
LIBNAME = libpng16
|
||||
PNGMAJ = 16
|
||||
RELEASE = 20
|
||||
RELEASE = 21
|
||||
|
||||
# Shared library names:
|
||||
LIBSO=$(LIBNAME).dll
|
||||
|
@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng16
|
||||
|
||||
LIB= png16
|
||||
SHLIB_MAJOR= 0
|
||||
SHLIB_MINOR= 1.6.20
|
||||
SHLIB_MINOR= 1.6.21
|
||||
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||
pngwtran.c pngmem.c pngerror.c pngpread.c
|
||||
|
@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include
|
||||
|
||||
LIB= png
|
||||
SHLIB_MAJOR= 16
|
||||
SHLIB_MINOR= 1.6.20
|
||||
SHLIB_MINOR= 1.6.21
|
||||
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||
pngwtran.c pngmem.c pngerror.c pngpread.c
|
||||
|
@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
|
||||
MANDIR= ${PREFIX}/man/cat
|
||||
|
||||
SHLIB_MAJOR= 16
|
||||
SHLIB_MINOR= 1.6.20
|
||||
SHLIB_MINOR= 1.6.21
|
||||
|
||||
LIB= png
|
||||
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
|
||||
|
@ -8,7 +8,7 @@ com pnglibconf.h - library build configuration
|
||||
com
|
||||
version
|
||||
com
|
||||
com Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
com Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||
com
|
||||
com This code is released under the libpng license.
|
||||
com For conditions of distribution and use, see the disclaimer
|
||||
@ -274,12 +274,12 @@ setting DEFAULT_READ_MACROS default 1
|
||||
|
||||
option READ_INT_FUNCTIONS requires READ
|
||||
|
||||
# The same for write, but these can only be switched off if
|
||||
# no writing is required at all - hence the use of an 'enables'
|
||||
# not a 'requires' below:
|
||||
# The same for write but these can only be switched off if no writing
|
||||
# is required at all - hence the use of a 'disabled', not a 'requires'.
|
||||
# If these are needed, they are enabled in the 'WRITE options' section
|
||||
# below.
|
||||
|
||||
option WRITE_INT_FUNCTIONS disabled
|
||||
option WRITE enables WRITE_INT_FUNCTIONS
|
||||
|
||||
# Error controls
|
||||
#
|
||||
@ -490,7 +490,7 @@ option BUILD_GRAYSCALE_PALETTE
|
||||
|
||||
# WRITE options
|
||||
|
||||
option WRITE
|
||||
option WRITE enables WRITE_INT_FUNCTIONS
|
||||
|
||||
# Disabling WRITE_16BIT prevents 16-bit PNG files from being
|
||||
# generated.
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* libpng 1.6.20 STANDARD API DEFINITION */
|
||||
/* libpng 1.6.21 STANDARD API DEFINITION */
|
||||
|
||||
/* pnglibconf.h - library build configuration */
|
||||
|
||||
/* Libpng version 1.6.20 - December 3, 2015 */
|
||||
/* Libpng version 1.6.21 - January 15, 2016 */
|
||||
|
||||
/* Copyright (c) 1998-2015 Glenn Randers-Pehrson */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
;Version 1.6.20
|
||||
;Version 1.6.21
|
||||
;--------------------------------------------------------------
|
||||
; LIBPNG symbol list as a Win32 DEF file
|
||||
; Contains all the symbols that can be exported from libpng
|
||||
|
@ -17,7 +17,7 @@ gamma="$1"
|
||||
shift
|
||||
alpha="$1"
|
||||
shift
|
||||
exec ./pngstest --tmpfile "${gamma}-${alpha}-" --log ${1+"$@"} $(
|
||||
exec ./pngstest --tmpfile "${gamma}-${alpha}-" --log ${1+"$@"} `
|
||||
for f in "${srcdir}/contrib/testpngs/"*.png
|
||||
do
|
||||
g=
|
||||
@ -49,4 +49,4 @@ exec ./pngstest --tmpfile "${gamma}-${alpha}-" --log ${1+"$@"} $(
|
||||
test "$alpha" = "opaque" -o "$alpha" = "none" && echo "$g";;
|
||||
esac
|
||||
done
|
||||
)
|
||||
`
|
||||
|
Loading…
Reference in New Issue
Block a user