mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-12-24 13:45:47 +00:00
Update libpng to 1.5.12
This commit is contained in:
parent
cb745baa5e
commit
f369fa48c8
13 changed files with 532 additions and 860 deletions
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.5.7 [December 15, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.11 [June 14, 2012]
|
||||
* Copyright (c) 1998-2012 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_5_7 Your_png_h_is_not_version_1_5_7;
|
||||
typedef png_libpng_version_1_5_12 Your_png_h_is_not_version_1_5_12;
|
||||
|
||||
/* 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
|
||||
|
@ -655,14 +655,14 @@ png_get_copyright(png_const_structp png_ptr)
|
|||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.5.7 - December 15, 2011" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2011 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.5.12 - July 11, 2012" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2012 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.5.7 - December 15, 2011\
|
||||
Copyright (c) 1998-2011 Glenn Randers-Pehrson\
|
||||
return "libpng version 1.5.12 - July 11, 2012\
|
||||
Copyright (c) 1998-2012 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
# endif
|
||||
|
@ -969,8 +969,8 @@ int png_XYZ_from_xy(png_XYZ *XYZ, png_xy xy)
|
|||
* and it is certain that it becomes unstable where the end points are close
|
||||
* together.
|
||||
*
|
||||
* So this code uses the perhaps slighly less optimal but more understandable
|
||||
* and totally obvious approach of calculating color-scale.
|
||||
* So this code uses the perhaps slightly less optimal but more
|
||||
* understandable and totally obvious approach of calculating color-scale.
|
||||
*
|
||||
* This algorithm depends on the precision in white-scale and that is
|
||||
* (1/white-y), so we can immediately see that as white-y approaches 0 the
|
||||
|
@ -1467,7 +1467,7 @@ static double
|
|||
png_pow10(int power)
|
||||
{
|
||||
int recip = 0;
|
||||
double d = 1;
|
||||
double d = 1.0;
|
||||
|
||||
/* Handle negative exponent with a reciprocal at the end because
|
||||
* 10 is exact whereas .1 is inexact in base 2
|
||||
|
@ -1481,7 +1481,7 @@ png_pow10(int power)
|
|||
if (power > 0)
|
||||
{
|
||||
/* Decompose power bitwise. */
|
||||
double mult = 10;
|
||||
double mult = 10.0;
|
||||
do
|
||||
{
|
||||
if (power & 1) d *= mult;
|
||||
|
@ -1600,7 +1600,8 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
|
|||
{
|
||||
double d;
|
||||
|
||||
fp *= 10;
|
||||
fp *= 10.0;
|
||||
|
||||
/* Use modf here, not floor and subtract, so that
|
||||
* the separation is done in one step. At the end
|
||||
* of the loop don't break the number into parts so
|
||||
|
@ -1613,7 +1614,7 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
|
|||
{
|
||||
d = floor(fp + .5);
|
||||
|
||||
if (d > 9)
|
||||
if (d > 9.0)
|
||||
{
|
||||
/* Rounding up to 10, handle that here. */
|
||||
if (czero > 0)
|
||||
|
@ -1621,9 +1622,10 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
|
|||
--czero, d = 1;
|
||||
if (cdigits == 0) --clead;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
while (cdigits > 0 && d > 9)
|
||||
while (cdigits > 0 && d > 9.0)
|
||||
{
|
||||
int ch = *--ascii;
|
||||
|
||||
|
@ -1648,7 +1650,7 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
|
|||
* exponent but take into account the leading
|
||||
* decimal point.
|
||||
*/
|
||||
if (d > 9) /* cdigits == 0 */
|
||||
if (d > 9.0) /* cdigits == 0 */
|
||||
{
|
||||
if (exp_b10 == (-1))
|
||||
{
|
||||
|
@ -1669,18 +1671,19 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
|
|||
++exp_b10;
|
||||
|
||||
/* In all cases we output a '1' */
|
||||
d = 1;
|
||||
d = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
fp = 0; /* Guarantees termination below. */
|
||||
}
|
||||
|
||||
if (d == 0)
|
||||
if (d == 0.0)
|
||||
{
|
||||
++czero;
|
||||
if (cdigits == 0) ++clead;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* Included embedded zeros in the digit count. */
|
||||
|
@ -1708,6 +1711,7 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
|
|||
above */
|
||||
--exp_b10;
|
||||
}
|
||||
|
||||
*ascii++ = (char)(48 + (int)d), ++cdigits;
|
||||
}
|
||||
}
|
||||
|
@ -2040,7 +2044,7 @@ png_muldiv_warn(png_structp png_ptr, png_fixed_point a, png_int_32 times,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED /* more fixed point functions for gammma */
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED /* more fixed point functions for gamma */
|
||||
/* Calculate a reciprocal, return 0 on div-by-zero or overflow. */
|
||||
png_fixed_point
|
||||
png_reciprocal(png_fixed_point a)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.5.7 - December 15, 2011
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* libpng version 1.5.12 - July 11, 2012
|
||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -11,7 +11,7 @@
|
|||
* Authors and maintainers:
|
||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.5.7 - December 15, 2011: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.5.12 - July 11, 2012: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
|
@ -166,6 +166,18 @@
|
|||
* 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.5.8beta01 15 10508 15.so.15.8[.0]
|
||||
* 1.5.8rc01 15 10508 15.so.15.8[.0]
|
||||
* 1.5.8 15 10508 15.so.15.8[.0]
|
||||
* 1.5.9beta01-02 15 10509 15.so.15.9[.0]
|
||||
* 1.5.9rc01 15 10509 15.so.15.9[.0]
|
||||
* 1.5.9 15 10509 15.so.15.9[.0]
|
||||
* 1.5.10beta01-05 15 10510 15.so.15.10[.0]
|
||||
* 1.5.10 15 10510 15.so.15.10[.0]
|
||||
* 1.5.11beta01 15 10511 15.so.15.11[.0]
|
||||
* 1.5.11rc01-05 15 10511 15.so.15.11[.0]
|
||||
* 1.5.11 15 10511 15.so.15.11[.0]
|
||||
* 1.5.12 15 10512 15.so.15.12[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
|
@ -175,7 +187,7 @@
|
|||
* 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 "rcN".
|
||||
* 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
|
||||
|
@ -197,8 +209,8 @@
|
|||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.5.7, December 15, 2011, are
|
||||
* Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.5.12, July 11, 2012, are
|
||||
* Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are
|
||||
* distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
* with the following individual added to the list of Contributing Authors:
|
||||
*
|
||||
|
@ -309,13 +321,13 @@
|
|||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* December 15, 2011
|
||||
* July 11, 2012
|
||||
*
|
||||
* 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.5.7 are Y2K compliant. It is my belief that
|
||||
* upward through 1.5.12 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
|
||||
|
@ -326,7 +338,8 @@
|
|||
* "png_uint_16 year" in png_time_struct.
|
||||
*
|
||||
* The string is
|
||||
* "png_char time_buffer" in png_struct
|
||||
* "char time_buffer[29]" in png_struct. This will be no
|
||||
* longer used in libpng-1.6.0 and will be removed from libpng-1.7.0.
|
||||
*
|
||||
* There are seven time-related functions:
|
||||
* png.c: png_convert_to_rfc_1123() in png.c
|
||||
|
@ -373,9 +386,9 @@
|
|||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.5.7"
|
||||
#define PNG_LIBPNG_VER_STRING "1.5.12"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.5.7 - December 15, 2011\n"
|
||||
" libpng version 1.5.12 - July 11, 2012\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 15
|
||||
#define PNG_LIBPNG_VER_DLLNUM 15
|
||||
|
@ -383,7 +396,7 @@
|
|||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 5
|
||||
#define PNG_LIBPNG_VER_RELEASE 7
|
||||
#define PNG_LIBPNG_VER_RELEASE 12
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
|
@ -406,7 +419,7 @@
|
|||
#define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
|
||||
PNG_LIBPNG_BUILD_PRIVATE */
|
||||
|
||||
#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA
|
||||
#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
|
||||
|
||||
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
|
||||
* We must not include leading zeros.
|
||||
|
@ -414,7 +427,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 10507 /* 1.5.7 */
|
||||
#define PNG_LIBPNG_VER 10512 /* 1.5.12 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
|
@ -536,7 +549,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_5_7;
|
||||
typedef char* png_libpng_version_1_5_12;
|
||||
|
||||
/* Three color definitions. The order of the red, green, and blue, (and the
|
||||
* exact size) is not important, although the size of the fields need to
|
||||
|
@ -2631,6 +2644,12 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
|
|||
: (png_int_32)png_get_uint_32(buf)))
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
|
||||
defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
|
||||
PNG_EXPORT(234, void, png_set_check_for_invalid_index, (png_structp png_ptr,
|
||||
int allowed));
|
||||
#endif
|
||||
|
||||
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project
|
||||
* defs
|
||||
*/
|
||||
|
@ -2640,7 +2659,7 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
|
|||
* scripts/symbols.def as well.
|
||||
*/
|
||||
#ifdef PNG_EXPORT_LAST_ORDINAL
|
||||
PNG_EXPORT_LAST_ORDINAL(233);
|
||||
PNG_EXPORT_LAST_ORDINAL(234);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.5.7 - December 15, 2011
|
||||
* libpng version 1.5.12 - July 11, 2012
|
||||
*
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2012 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.)
|
||||
*
|
||||
|
@ -25,7 +25,7 @@
|
|||
#ifndef PNG_BUILDING_SYMBOL_TABLE
|
||||
/* PNG_NO_LIMITS_H may be used to turn off the use of the standard C
|
||||
* definition file for machine specific limits, this may impact the
|
||||
* correctness of the definitons below (see uses of INT_MAX).
|
||||
* correctness of the definitions below (see uses of INT_MAX).
|
||||
*/
|
||||
# ifndef PNG_NO_LIMITS_H
|
||||
# include <limits.h>
|
||||
|
@ -51,8 +51,8 @@
|
|||
|
||||
/* This controls optimization of the reading of 16 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 to the function is called.
|
||||
* The library builder sets the default, if read functions are not
|
||||
* just changes whether a macro is used when the function is called.
|
||||
* The library builder sets the default; if read functions are not
|
||||
* built into the library the macro implementation is forced on.
|
||||
*/
|
||||
#ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.5.7 [December 15, 2011]
|
||||
* Last changed in libpng 1.5.8 [February 1, 2011]
|
||||
* Copyright (c) 1998-2011 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.)
|
||||
|
@ -281,35 +281,40 @@ void
|
|||
png_formatted_warning(png_structp png_ptr, png_warning_parameters p,
|
||||
png_const_charp message)
|
||||
{
|
||||
/* The internal buffer is just 128 bytes - enough for all our messages,
|
||||
* overflow doesn't happen because this code checks!
|
||||
/* The internal buffer is just 192 bytes - enough for all our messages,
|
||||
* overflow doesn't happen because this code checks! If someone figures
|
||||
* out how to send us a message longer than 192 bytes, all that will
|
||||
* happen is that the message will be truncated appropriately.
|
||||
*/
|
||||
size_t i;
|
||||
char msg[128];
|
||||
size_t i = 0; /* Index in the msg[] buffer: */
|
||||
char msg[192];
|
||||
|
||||
for (i=0; i<(sizeof msg)-1 && *message != '\0'; ++i)
|
||||
/* Each iteration through the following loop writes at most one character
|
||||
* to msg[i++] then returns here to validate that there is still space for
|
||||
* the trailing '\0'. It may (in the case of a parameter) read more than
|
||||
* one character from message[]; it must check for '\0' and continue to the
|
||||
* test if it finds the end of string.
|
||||
*/
|
||||
while (i<(sizeof msg)-1 && *message != '\0')
|
||||
{
|
||||
if (*message == '@')
|
||||
/* '@' at end of string is now just printed (previously it was skipped);
|
||||
* it is an error in the calling code to terminate the string with @.
|
||||
*/
|
||||
if (p != NULL && *message == '@' && message[1] != '\0')
|
||||
{
|
||||
int parameter = -1;
|
||||
switch (*++message)
|
||||
{
|
||||
case '1':
|
||||
parameter = 0;
|
||||
break;
|
||||
int parameter_char = *++message; /* Consume the '@' */
|
||||
static const char valid_parameters[] = "123456789";
|
||||
int parameter = 0;
|
||||
|
||||
case '2':
|
||||
parameter = 1;
|
||||
break;
|
||||
/* Search for the parameter digit, the index in the string is the
|
||||
* parameter to use.
|
||||
*/
|
||||
while (valid_parameters[parameter] != parameter_char &&
|
||||
valid_parameters[parameter] != '\0')
|
||||
++parameter;
|
||||
|
||||
case '\0':
|
||||
continue; /* To break out of the for loop above. */
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (parameter >= 0 && parameter < PNG_WARNING_PARAMETER_COUNT)
|
||||
/* If the parameter digit is out of range it will just get printed. */
|
||||
if (parameter < PNG_WARNING_PARAMETER_COUNT)
|
||||
{
|
||||
/* Append this parameter */
|
||||
png_const_charp parm = p[parameter];
|
||||
|
@ -319,28 +324,32 @@ png_formatted_warning(png_structp png_ptr, png_warning_parameters p,
|
|||
* that parm[] has been initialized, so there is no guarantee of a
|
||||
* trailing '\0':
|
||||
*/
|
||||
for (; i<(sizeof msg)-1 && parm != '\0' && parm < pend; ++i)
|
||||
msg[i] = *parm++;
|
||||
while (i<(sizeof msg)-1 && *parm != '\0' && parm < pend)
|
||||
msg[i++] = *parm++;
|
||||
|
||||
/* Consume the parameter digit too: */
|
||||
++message;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* else not a parameter and there is a character after the @ sign; just
|
||||
* copy that.
|
||||
* copy that. This is known not to be '\0' because of the test above.
|
||||
*/
|
||||
}
|
||||
|
||||
/* At this point *message can't be '\0', even in the bad parameter case
|
||||
* above where there is a lone '@' at the end of the message string.
|
||||
*/
|
||||
msg[i] = *message++;
|
||||
msg[i++] = *message++;
|
||||
}
|
||||
|
||||
/* i is always less than (sizeof msg), so: */
|
||||
msg[i] = '\0';
|
||||
|
||||
/* And this is the formatted message: */
|
||||
/* And this is the formatted message, it may be larger than
|
||||
* PNG_MAX_ERROR_TEXT, but that is only used for 'chunk' errors and these are
|
||||
* not (currently) formatted.
|
||||
*/
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
||||
|
|
|
@ -1,189 +1,180 @@
|
|||
/* pnglibconf.h - library build configuration */
|
||||
|
||||
/* libpng STANDARD API DEFINITION */
|
||||
/* libpng version 1.5.12 - July 11, 2012 */
|
||||
|
||||
/* pnglibconf.h - library build configuration */
|
||||
/* Copyright (c) 1998-2011 Glenn Randers-Pehrson */
|
||||
|
||||
/* Libpng 1.5.7 - December 15, 2011 */
|
||||
|
||||
/* Copyright (c) 1998-2011 Glenn Randers-Pehrson */
|
||||
|
||||
/* This code is released under the libpng license. */
|
||||
/* For conditions of distribution and use, see the disclaimer */
|
||||
/* and license in png.h */
|
||||
/* This code is released under the libpng license. */
|
||||
/* For conditions of distribution and use, see the disclaimer */
|
||||
/* and license in png.h */
|
||||
|
||||
/* pnglibconf.h */
|
||||
/* Machine generated file: DO NOT EDIT */
|
||||
/* Derived from: scripts/pnglibconf.dfa */
|
||||
/* If you edit this file by hand you must obey the rules expressed in */
|
||||
/* pnglibconf.dfa with respect to the dependencies between the following */
|
||||
/* symbols. It is much better to generate a new file using */
|
||||
/* scripts/libpngconf.mak */
|
||||
|
||||
#ifndef PNGLCONF_H
|
||||
#define PNGLCONF_H
|
||||
/* settings */
|
||||
#define PNG_API_RULE 0
|
||||
#define PNG_CALLOC_SUPPORTED
|
||||
#define PNG_COST_SHIFT 3
|
||||
#define PNG_DEFAULT_READ_MACROS 1
|
||||
#define PNG_GAMMA_THRESHOLD_FIXED 5000
|
||||
#define PNG_MAX_GAMMA_8 11
|
||||
#define PNG_QUANTIZE_BLUE_BITS 5
|
||||
#define PNG_QUANTIZE_GREEN_BITS 5
|
||||
#define PNG_CALLOC_SUPPORTED
|
||||
#define PNG_QUANTIZE_RED_BITS 5
|
||||
#define PNG_QUANTIZE_GREEN_BITS 5
|
||||
#define PNG_API_RULE 0
|
||||
#define PNG_QUANTIZE_BLUE_BITS 5
|
||||
#define PNG_sCAL_PRECISION 5
|
||||
#define PNG_USER_CHUNK_CACHE_MAX 0
|
||||
#define PNG_USER_CHUNK_MALLOC_MAX 0
|
||||
#define PNG_USER_HEIGHT_MAX 1000000
|
||||
#define PNG_USER_WIDTH_MAX 1000000
|
||||
#define PNG_COST_SHIFT 3
|
||||
#define PNG_WEIGHT_SHIFT 8
|
||||
#define PNG_DEFAULT_READ_MACROS 1
|
||||
#define PNG_ZBUF_SIZE 8192
|
||||
#define PNG_GAMMA_THRESHOLD_FIXED 5000
|
||||
/* end of settings */
|
||||
/* options */
|
||||
#define PNG_16BIT_SUPPORTED
|
||||
#define PNG_ALIGN_MEMORY_SUPPORTED
|
||||
#define PNG_BENIGN_ERRORS_SUPPORTED
|
||||
#define PNG_bKGD_SUPPORTED
|
||||
#define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
|
||||
#define PNG_CHECK_cHRM_SUPPORTED
|
||||
#define PNG_cHRM_SUPPORTED
|
||||
#define PNG_CONSOLE_IO_SUPPORTED
|
||||
#define PNG_CONVERT_tIME_SUPPORTED
|
||||
#define PNG_EASY_ACCESS_SUPPORTED
|
||||
#define PNG_INFO_IMAGE_SUPPORTED 1
|
||||
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED 1
|
||||
#define PNG_POINTER_INDEXING_SUPPORTED 1
|
||||
#define PNG_WARNINGS_SUPPORTED 1
|
||||
#define PNG_FLOATING_ARITHMETIC_SUPPORTED 1
|
||||
#define PNG_WRITE_SUPPORTED 1
|
||||
#define PNG_WRITE_INTERLACING_SUPPORTED 1
|
||||
#define PNG_WRITE_16BIT_SUPPORTED 1
|
||||
#define PNG_EASY_ACCESS_SUPPORTED 1
|
||||
#define PNG_ALIGN_MEMORY_SUPPORTED 1
|
||||
#define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED 1
|
||||
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED 1
|
||||
#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED 1
|
||||
#define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED 1
|
||||
#define PNG_FIXED_POINT_SUPPORTED 1
|
||||
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
|
||||
#define PNG_ERROR_TEXT_SUPPORTED
|
||||
#define PNG_FIXED_POINT_SUPPORTED
|
||||
#define PNG_FLOATING_ARITHMETIC_SUPPORTED
|
||||
#define PNG_FLOATING_POINT_SUPPORTED
|
||||
#define PNG_FORMAT_AFIRST_SUPPORTED
|
||||
#define PNG_FORMAT_BGR_SUPPORTED
|
||||
#define PNG_gAMA_SUPPORTED
|
||||
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||
#define PNG_hIST_SUPPORTED
|
||||
#define PNG_iCCP_SUPPORTED
|
||||
#define PNG_INCH_CONVERSIONS_SUPPORTED
|
||||
#define PNG_INFO_IMAGE_SUPPORTED
|
||||
#define PNG_IO_STATE_SUPPORTED
|
||||
#define PNG_iTXt_SUPPORTED
|
||||
#define PNG_MNG_FEATURES_SUPPORTED
|
||||
#define PNG_oFFs_SUPPORTED
|
||||
#define PNG_pCAL_SUPPORTED
|
||||
#define PNG_pHYs_SUPPORTED
|
||||
#define PNG_POINTER_INDEXING_SUPPORTED
|
||||
#define PNG_PROGRESSIVE_READ_SUPPORTED
|
||||
#define PNG_READ_16BIT_SUPPORTED
|
||||
#define PNG_READ_ALPHA_MODE_SUPPORTED
|
||||
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
|
||||
#define PNG_READ_BACKGROUND_SUPPORTED
|
||||
#define PNG_READ_BGR_SUPPORTED
|
||||
#define PNG_READ_bKGD_SUPPORTED
|
||||
#define PNG_READ_cHRM_SUPPORTED
|
||||
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
||||
#define PNG_READ_COMPRESSED_TEXT_SUPPORTED
|
||||
#define PNG_READ_EXPAND_16_SUPPORTED
|
||||
#define PNG_READ_EXPAND_SUPPORTED
|
||||
#define PNG_READ_FILLER_SUPPORTED
|
||||
#define PNG_READ_gAMA_SUPPORTED
|
||||
#define PNG_READ_GAMMA_SUPPORTED
|
||||
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||
#define PNG_READ_hIST_SUPPORTED
|
||||
#define PNG_READ_iCCP_SUPPORTED
|
||||
#define PNG_READ_INTERLACING_SUPPORTED
|
||||
#define PNG_READ_INT_FUNCTIONS_SUPPORTED
|
||||
#define PNG_READ_INVERT_ALPHA_SUPPORTED
|
||||
#define PNG_READ_INVERT_SUPPORTED
|
||||
#define PNG_READ_iTXt_SUPPORTED
|
||||
#define PNG_READ_oFFs_SUPPORTED
|
||||
#define PNG_READ_OPT_PLTE_SUPPORTED
|
||||
#define PNG_READ_PACK_SUPPORTED
|
||||
#define PNG_READ_PACKSWAP_SUPPORTED
|
||||
#define PNG_READ_pCAL_SUPPORTED
|
||||
#define PNG_READ_pHYs_SUPPORTED
|
||||
#define PNG_READ_QUANTIZE_SUPPORTED
|
||||
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||
#define PNG_READ_sBIT_SUPPORTED
|
||||
#define PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||
#define PNG_READ_sCAL_SUPPORTED
|
||||
#define PNG_READ_SHIFT_SUPPORTED
|
||||
#define PNG_READ_sPLT_SUPPORTED
|
||||
#define PNG_READ_sRGB_SUPPORTED
|
||||
#define PNG_READ_STRIP_16_TO_8_SUPPORTED
|
||||
#define PNG_READ_STRIP_ALPHA_SUPPORTED
|
||||
#define PNG_READ_SUPPORTED
|
||||
#define PNG_READ_SWAP_ALPHA_SUPPORTED
|
||||
#define PNG_READ_SWAP_SUPPORTED
|
||||
#define PNG_READ_tEXt_SUPPORTED
|
||||
#define PNG_READ_TEXT_SUPPORTED
|
||||
#define PNG_READ_tIME_SUPPORTED
|
||||
#define PNG_READ_TRANSFORMS_SUPPORTED
|
||||
#define PNG_READ_tRNS_SUPPORTED
|
||||
#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#define PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
#define PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||
#define PNG_READ_zTXt_SUPPORTED
|
||||
#define PNG_SAVE_INT_32_SUPPORTED
|
||||
#define PNG_sBIT_SUPPORTED
|
||||
#define PNG_sCAL_SUPPORTED
|
||||
#define PNG_SEQUENTIAL_READ_SUPPORTED
|
||||
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
|
||||
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||
#define PNG_SETJMP_SUPPORTED
|
||||
#define PNG_SET_USER_LIMITS_SUPPORTED
|
||||
#define PNG_sPLT_SUPPORTED
|
||||
#define PNG_sRGB_SUPPORTED
|
||||
#define PNG_STDIO_SUPPORTED
|
||||
#define PNG_tEXt_SUPPORTED
|
||||
#define PNG_TEXT_SUPPORTED
|
||||
#define PNG_TIME_RFC1123_SUPPORTED
|
||||
#define PNG_tIME_SUPPORTED
|
||||
#define PNG_tRNS_SUPPORTED
|
||||
#define PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#define PNG_USER_CHUNKS_SUPPORTED
|
||||
#define PNG_USER_LIMITS_SUPPORTED
|
||||
#define PNG_USER_MEM_SUPPORTED
|
||||
#define PNG_USER_TRANSFORM_INFO_SUPPORTED
|
||||
#define PNG_USER_TRANSFORM_PTR_SUPPORTED
|
||||
#define PNG_WARNINGS_SUPPORTED
|
||||
#define PNG_WRITE_16BIT_SUPPORTED
|
||||
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
|
||||
#define PNG_WRITE_BGR_SUPPORTED
|
||||
#define PNG_WRITE_bKGD_SUPPORTED
|
||||
#define PNG_WRITE_cHRM_SUPPORTED
|
||||
#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
|
||||
#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
|
||||
#define PNG_WRITE_FILLER_SUPPORTED
|
||||
#define PNG_WRITE_FILTER_SUPPORTED
|
||||
#define PNG_WRITE_FLUSH_SUPPORTED
|
||||
#define PNG_WRITE_gAMA_SUPPORTED
|
||||
#define PNG_WRITE_hIST_SUPPORTED
|
||||
#define PNG_WRITE_iCCP_SUPPORTED
|
||||
#define PNG_WRITE_INTERLACING_SUPPORTED
|
||||
#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
|
||||
#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||
#define PNG_WRITE_INVERT_SUPPORTED
|
||||
#define PNG_WRITE_iTXt_SUPPORTED
|
||||
#define PNG_WRITE_oFFs_SUPPORTED
|
||||
#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
|
||||
#define PNG_WRITE_PACK_SUPPORTED
|
||||
#define PNG_WRITE_PACKSWAP_SUPPORTED
|
||||
#define PNG_WRITE_pCAL_SUPPORTED
|
||||
#define PNG_WRITE_pHYs_SUPPORTED
|
||||
#define PNG_WRITE_sBIT_SUPPORTED
|
||||
#define PNG_WRITE_sCAL_SUPPORTED
|
||||
#define PNG_WRITE_SHIFT_SUPPORTED
|
||||
#define PNG_WRITE_sPLT_SUPPORTED
|
||||
#define PNG_WRITE_sRGB_SUPPORTED
|
||||
#define PNG_WRITE_SUPPORTED
|
||||
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||
#define PNG_WRITE_SWAP_SUPPORTED
|
||||
#define PNG_WRITE_tEXt_SUPPORTED
|
||||
#define PNG_WRITE_TEXT_SUPPORTED
|
||||
#define PNG_WRITE_tIME_SUPPORTED
|
||||
#define PNG_WRITE_TRANSFORMS_SUPPORTED
|
||||
#define PNG_WRITE_tRNS_SUPPORTED
|
||||
#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
#define PNG_WRITE_zTXt_SUPPORTED
|
||||
#define PNG_zTXt_SUPPORTED
|
||||
#define PNG_ERROR_TEXT_SUPPORTED 1
|
||||
#define PNG_READ_SUPPORTED 1
|
||||
#define PNG_BENIGN_ERRORS_SUPPORTED 1
|
||||
#define PNG_SETJMP_SUPPORTED 1
|
||||
#define PNG_TIME_RFC1123_SUPPORTED 1
|
||||
#define PNG_WRITE_FLUSH_SUPPORTED 1
|
||||
#define PNG_MNG_FEATURES_SUPPORTED 1
|
||||
/*#undef PNG_SAFE_LIMITS_SUPPORTED*/
|
||||
#define PNG_FLOATING_POINT_SUPPORTED 1
|
||||
#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED 1
|
||||
#define PNG_INCH_CONVERSIONS_SUPPORTED 1
|
||||
#define PNG_STDIO_SUPPORTED 1
|
||||
#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED 1
|
||||
#define PNG_USER_MEM_SUPPORTED 1
|
||||
#define PNG_IO_STATE_SUPPORTED 1
|
||||
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED 1
|
||||
#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED 1
|
||||
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED 1
|
||||
#define PNG_WRITE_FILTER_SUPPORTED 1
|
||||
#define PNG_WRITE_zTXt_SUPPORTED 1
|
||||
#define PNG_WRITE_iCCP_SUPPORTED 1
|
||||
#define PNG_READ_TRANSFORMS_SUPPORTED 1
|
||||
#define PNG_READ_bKGD_SUPPORTED 1
|
||||
#define PNG_UNKNOWN_CHUNKS_SUPPORTED 1
|
||||
#define PNG_READ_sCAL_SUPPORTED 1
|
||||
#define PNG_WRITE_hIST_SUPPORTED 1
|
||||
#define PNG_READ_OPT_PLTE_SUPPORTED 1
|
||||
#define PNG_WRITE_gAMA_SUPPORTED 1
|
||||
#define PNG_READ_GRAY_TO_RGB_SUPPORTED 1
|
||||
#define PNG_WRITE_pCAL_SUPPORTED 1
|
||||
#define PNG_READ_INVERT_ALPHA_SUPPORTED 1
|
||||
#define PNG_WRITE_TRANSFORMS_SUPPORTED 1
|
||||
#define PNG_READ_ALPHA_MODE_SUPPORTED 1
|
||||
#define PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED 1
|
||||
#define PNG_READ_sBIT_SUPPORTED 1
|
||||
#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED 1
|
||||
#define PNG_READ_PACK_SUPPORTED 1
|
||||
#define PNG_WRITE_iTXt_SUPPORTED 1
|
||||
#define PNG_WRITE_SWAP_SUPPORTED 1
|
||||
#define PNG_READ_cHRM_SUPPORTED 1
|
||||
#define PNG_READ_STRIP_16_TO_8_SUPPORTED 1
|
||||
#define PNG_WRITE_tIME_SUPPORTED 1
|
||||
#define PNG_READ_INTERLACING_SUPPORTED 1
|
||||
#define PNG_READ_tRNS_SUPPORTED 1
|
||||
#define PNG_WRITE_pHYs_SUPPORTED 1
|
||||
#define PNG_WRITE_INVERT_SUPPORTED 1
|
||||
#define PNG_READ_RGB_TO_GRAY_SUPPORTED 1
|
||||
#define PNG_WRITE_sRGB_SUPPORTED 1
|
||||
#define PNG_READ_oFFs_SUPPORTED 1
|
||||
#define PNG_WRITE_FILLER_SUPPORTED 1
|
||||
#define PNG_WRITE_SHIFT_SUPPORTED 1
|
||||
#define PNG_PROGRESSIVE_READ_SUPPORTED 1
|
||||
#define PNG_READ_SHIFT_SUPPORTED 1
|
||||
#define PNG_CONVERT_tIME_SUPPORTED 1
|
||||
#define PNG_READ_USER_TRANSFORM_SUPPORTED 1
|
||||
#define PNG_READ_INT_FUNCTIONS_SUPPORTED 1
|
||||
#define PNG_READ_USER_CHUNKS_SUPPORTED 1
|
||||
#define PNG_READ_hIST_SUPPORTED 1
|
||||
#define PNG_READ_16BIT_SUPPORTED 1
|
||||
#define PNG_READ_SWAP_ALPHA_SUPPORTED 1
|
||||
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED 1
|
||||
#define PNG_SEQUENTIAL_READ_SUPPORTED 1
|
||||
#define PNG_READ_BACKGROUND_SUPPORTED 1
|
||||
#define PNG_READ_QUANTIZE_SUPPORTED 1
|
||||
#define PNG_READ_zTXt_SUPPORTED 1
|
||||
#define PNG_USER_LIMITS_SUPPORTED 1
|
||||
#define PNG_READ_iCCP_SUPPORTED 1
|
||||
#define PNG_READ_STRIP_ALPHA_SUPPORTED 1
|
||||
#define PNG_READ_PACKSWAP_SUPPORTED 1
|
||||
#define PNG_READ_sRGB_SUPPORTED 1
|
||||
#define PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED 1
|
||||
#define PNG_READ_pCAL_SUPPORTED 1
|
||||
#define PNG_WRITE_sPLT_SUPPORTED 1
|
||||
#define PNG_READ_iTXt_SUPPORTED 1
|
||||
#define PNG_READ_SWAP_SUPPORTED 1
|
||||
#define PNG_READ_tIME_SUPPORTED 1
|
||||
#define PNG_READ_pHYs_SUPPORTED 1
|
||||
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED 1
|
||||
#define PNG_READ_SCALE_16_TO_8_SUPPORTED 1
|
||||
#define PNG_WRITE_BGR_SUPPORTED 1
|
||||
#define PNG_USER_CHUNKS_SUPPORTED 1
|
||||
#define PNG_CONSOLE_IO_SUPPORTED 1
|
||||
#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED 1
|
||||
#define PNG_WRITE_PACK_SUPPORTED 1
|
||||
#define PNG_READ_FILLER_SUPPORTED 1
|
||||
#define PNG_WRITE_bKGD_SUPPORTED 1
|
||||
#define PNG_WRITE_tRNS_SUPPORTED 1
|
||||
#define PNG_READ_sPLT_SUPPORTED 1
|
||||
#define PNG_WRITE_sCAL_SUPPORTED 1
|
||||
#define PNG_WRITE_oFFs_SUPPORTED 1
|
||||
#define PNG_SET_USER_LIMITS_SUPPORTED 1
|
||||
#define PNG_WRITE_sBIT_SUPPORTED 1
|
||||
#define PNG_READ_INVERT_SUPPORTED 1
|
||||
#define PNG_WRITE_cHRM_SUPPORTED 1
|
||||
#define PNG_16BIT_SUPPORTED 1
|
||||
#define PNG_WRITE_USER_TRANSFORM_SUPPORTED 1
|
||||
#define PNG_READ_BGR_SUPPORTED 1
|
||||
#define PNG_WRITE_PACKSWAP_SUPPORTED 1
|
||||
#define PNG_WRITE_INVERT_ALPHA_SUPPORTED 1
|
||||
#define PNG_sCAL_SUPPORTED 1
|
||||
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED 1
|
||||
#define PNG_READ_GAMMA_SUPPORTED 1
|
||||
#define PNG_USER_TRANSFORM_INFO_SUPPORTED 1
|
||||
#define PNG_sBIT_SUPPORTED 1
|
||||
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED 1
|
||||
#define PNG_cHRM_SUPPORTED 1
|
||||
#define PNG_bKGD_SUPPORTED 1
|
||||
#define PNG_tRNS_SUPPORTED 1
|
||||
#define PNG_oFFs_SUPPORTED 1
|
||||
#define PNG_READ_EXPAND_16_SUPPORTED 1
|
||||
#define PNG_USER_TRANSFORM_PTR_SUPPORTED 1
|
||||
#define PNG_WRITE_TEXT_SUPPORTED 1
|
||||
#define PNG_READ_COMPRESSED_TEXT_SUPPORTED 1
|
||||
#define PNG_hIST_SUPPORTED 1
|
||||
#define PNG_zTXt_SUPPORTED 1
|
||||
#define PNG_iCCP_SUPPORTED 1
|
||||
#define PNG_sRGB_SUPPORTED 1
|
||||
#define PNG_pCAL_SUPPORTED 1
|
||||
#define PNG_WRITE_tEXt_SUPPORTED 1
|
||||
#define PNG_CHECK_cHRM_SUPPORTED 1
|
||||
#define PNG_READ_gAMA_SUPPORTED 1
|
||||
#define PNG_iTXt_SUPPORTED 1
|
||||
#define PNG_tIME_SUPPORTED 1
|
||||
#define PNG_READ_EXPAND_SUPPORTED 1
|
||||
#define PNG_pHYs_SUPPORTED 1
|
||||
#define PNG_READ_TEXT_SUPPORTED 1
|
||||
#define PNG_SAVE_INT_32_SUPPORTED 1
|
||||
#define PNG_sPLT_SUPPORTED 1
|
||||
#define PNG_READ_tEXt_SUPPORTED 1
|
||||
#define PNG_gAMA_SUPPORTED 1
|
||||
#define PNG_TEXT_SUPPORTED 1
|
||||
#define PNG_tEXt_SUPPORTED 1
|
||||
/* end of options */
|
||||
#endif /* PNGLCONF_H */
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.5.7 [December 15, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.11 [June 14, 2012]
|
||||
* Copyright (c) 1998-2012 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.)
|
||||
*
|
||||
|
@ -128,30 +128,6 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_tEXt_SUPPORTED
|
||||
case PNG_READ_tEXt_MODE:
|
||||
{
|
||||
png_push_read_tEXt(png_ptr, info_ptr);
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef PNG_READ_zTXt_SUPPORTED
|
||||
case PNG_READ_zTXt_MODE:
|
||||
{
|
||||
png_push_read_zTXt(png_ptr, info_ptr);
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef PNG_READ_iTXt_SUPPORTED
|
||||
case PNG_READ_iTXt_MODE:
|
||||
{
|
||||
png_push_read_iTXt(png_ptr, info_ptr);
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
case PNG_SKIP_MODE:
|
||||
{
|
||||
png_push_crc_finish(png_ptr);
|
||||
|
@ -176,7 +152,7 @@ void /* PRIVATE */
|
|||
png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
png_size_t num_checked = png_ptr->sig_bytes,
|
||||
num_to_check = 8 - num_checked;
|
||||
num_to_check = 8 - num_checked;
|
||||
|
||||
if (png_ptr->buffer_size < num_to_check)
|
||||
{
|
||||
|
@ -196,6 +172,7 @@ png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
|
|||
else
|
||||
png_error(png_ptr, "PNG file corrupted by ASCII conversion");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (png_ptr->sig_bytes >= 8)
|
||||
|
@ -305,8 +282,8 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||
png_error(png_ptr, "Missing PLTE before IDAT");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
else if (chunk_name == png_PLTE)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
|
@ -543,7 +520,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||
return;
|
||||
}
|
||||
|
||||
png_push_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||
png_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -556,7 +533,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||
return;
|
||||
}
|
||||
|
||||
png_push_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||
png_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -569,10 +546,11 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||
return;
|
||||
}
|
||||
|
||||
png_push_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||
png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
else
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
|
@ -580,7 +558,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
png_push_handle_unknown(png_ptr, info_ptr, png_ptr->push_length);
|
||||
png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
|
||||
|
@ -620,6 +598,7 @@ png_push_crc_finish(png_structp png_ptr)
|
|||
png_ptr->save_buffer_size -= save_size;
|
||||
png_ptr->save_buffer_ptr += save_size;
|
||||
}
|
||||
|
||||
if (png_ptr->skip_length && png_ptr->current_buffer_size)
|
||||
{
|
||||
png_size_t save_size = png_ptr->current_buffer_size;
|
||||
|
@ -641,6 +620,7 @@ png_push_crc_finish(png_structp png_ptr)
|
|||
png_ptr->current_buffer_size -= save_size;
|
||||
png_ptr->current_buffer_ptr += save_size;
|
||||
}
|
||||
|
||||
if (!png_ptr->skip_length)
|
||||
{
|
||||
if (png_ptr->buffer_size < 4)
|
||||
|
@ -663,6 +643,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
|||
return;
|
||||
|
||||
ptr = buffer;
|
||||
|
||||
if (png_ptr->save_buffer_size)
|
||||
{
|
||||
png_size_t save_size;
|
||||
|
@ -680,6 +661,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
|||
png_ptr->save_buffer_size -= save_size;
|
||||
png_ptr->save_buffer_ptr += save_size;
|
||||
}
|
||||
|
||||
if (length && png_ptr->current_buffer_size)
|
||||
{
|
||||
png_size_t save_size;
|
||||
|
@ -709,6 +691,7 @@ png_push_save_buffer(png_structp png_ptr)
|
|||
png_bytep dp;
|
||||
|
||||
istop = png_ptr->save_buffer_size;
|
||||
|
||||
for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer;
|
||||
i < istop; i++, sp++, dp++)
|
||||
{
|
||||
|
@ -716,6 +699,7 @@ png_push_save_buffer(png_structp png_ptr)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (png_ptr->save_buffer_size + png_ptr->current_buffer_size >
|
||||
png_ptr->save_buffer_max)
|
||||
{
|
||||
|
@ -730,8 +714,7 @@ png_push_save_buffer(png_structp png_ptr)
|
|||
|
||||
new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256;
|
||||
old_buffer = png_ptr->save_buffer;
|
||||
png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr,
|
||||
(png_size_t)new_max);
|
||||
png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr, new_max);
|
||||
|
||||
if (png_ptr->save_buffer == NULL)
|
||||
{
|
||||
|
@ -743,6 +726,7 @@ png_push_save_buffer(png_structp png_ptr)
|
|||
png_free(png_ptr, old_buffer);
|
||||
png_ptr->save_buffer_max = new_max;
|
||||
}
|
||||
|
||||
if (png_ptr->current_buffer_size)
|
||||
{
|
||||
png_memcpy(png_ptr->save_buffer + png_ptr->save_buffer_size,
|
||||
|
@ -750,6 +734,7 @@ png_push_save_buffer(png_structp png_ptr)
|
|||
png_ptr->save_buffer_size += png_ptr->current_buffer_size;
|
||||
png_ptr->current_buffer_size = 0;
|
||||
}
|
||||
|
||||
png_ptr->save_buffer_ptr = png_ptr->save_buffer;
|
||||
png_ptr->buffer_size = 0;
|
||||
}
|
||||
|
@ -851,6 +836,7 @@ png_push_read_IDAT(png_structp png_ptr)
|
|||
png_ptr->current_buffer_size -= save_size;
|
||||
png_ptr->current_buffer_ptr += save_size;
|
||||
}
|
||||
|
||||
if (!png_ptr->idat_size)
|
||||
{
|
||||
if (png_ptr->buffer_size < 4)
|
||||
|
@ -1201,6 +1187,7 @@ png_push_process_row(png_structp png_ptr)
|
|||
void /* PRIVATE */
|
||||
png_read_push_finish_row(png_structp png_ptr)
|
||||
{
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
|
||||
/* Start of interlace block */
|
||||
|
@ -1219,6 +1206,7 @@ png_read_push_finish_row(png_structp png_ptr)
|
|||
* it, uncomment it here and in png.h
|
||||
static PNG_CONST png_byte FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
||||
*/
|
||||
#endif
|
||||
|
||||
png_ptr->row_number++;
|
||||
if (png_ptr->row_number < png_ptr->num_rows)
|
||||
|
@ -1262,525 +1250,6 @@ png_read_push_finish_row(png_structp png_ptr)
|
|||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_tEXt_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
length)
|
||||
{
|
||||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||
{
|
||||
PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
|
||||
png_error(png_ptr, "Out of place tEXt");
|
||||
/* NOT REACHED */
|
||||
}
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
png_ptr->skip_length = 0; /* This may not be necessary */
|
||||
|
||||
if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */
|
||||
{
|
||||
png_warning(png_ptr, "tEXt chunk too large to fit in memory");
|
||||
png_ptr->skip_length = length - (png_uint_32)65535L;
|
||||
length = (png_uint_32)65535L;
|
||||
}
|
||||
#endif
|
||||
|
||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||
(png_size_t)(length + 1));
|
||||
png_ptr->current_text[length] = '\0';
|
||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||
png_ptr->current_text_size = (png_size_t)length;
|
||||
png_ptr->current_text_left = (png_size_t)length;
|
||||
png_ptr->process_mode = PNG_READ_tEXt_MODE;
|
||||
}
|
||||
|
||||
void /* PRIVATE */
|
||||
png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr->buffer_size && png_ptr->current_text_left)
|
||||
{
|
||||
png_size_t text_size;
|
||||
|
||||
if (png_ptr->buffer_size < png_ptr->current_text_left)
|
||||
text_size = png_ptr->buffer_size;
|
||||
|
||||
else
|
||||
text_size = png_ptr->current_text_left;
|
||||
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size);
|
||||
png_ptr->current_text_left -= text_size;
|
||||
png_ptr->current_text_ptr += text_size;
|
||||
}
|
||||
if (!(png_ptr->current_text_left))
|
||||
{
|
||||
png_textp text_ptr;
|
||||
png_charp text;
|
||||
png_charp key;
|
||||
int ret;
|
||||
|
||||
if (png_ptr->buffer_size < 4)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
png_push_crc_finish(png_ptr);
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
if (png_ptr->skip_length)
|
||||
return;
|
||||
#endif
|
||||
|
||||
key = png_ptr->current_text;
|
||||
|
||||
for (text = key; *text; text++)
|
||||
/* Empty loop */ ;
|
||||
|
||||
if (text < key + png_ptr->current_text_size)
|
||||
text++;
|
||||
|
||||
text_ptr = (png_textp)png_malloc(png_ptr, png_sizeof(png_text));
|
||||
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
text_ptr->key = key;
|
||||
text_ptr->itxt_length = 0;
|
||||
text_ptr->lang = NULL;
|
||||
text_ptr->lang_key = NULL;
|
||||
text_ptr->text = text;
|
||||
|
||||
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
|
||||
|
||||
png_free(png_ptr, key);
|
||||
png_free(png_ptr, text_ptr);
|
||||
png_ptr->current_text = NULL;
|
||||
|
||||
if (ret)
|
||||
png_warning(png_ptr, "Insufficient memory to store text chunk");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_zTXt_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
length)
|
||||
{
|
||||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||
{
|
||||
PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
|
||||
png_error(png_ptr, "Out of place zTXt");
|
||||
/* NOT REACHED */
|
||||
}
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
/* We can't handle zTXt chunks > 64K, since we don't have enough space
|
||||
* to be able to store the uncompressed data. Actually, the threshold
|
||||
* is probably around 32K, but it isn't as definite as 64K is.
|
||||
*/
|
||||
if (length > (png_uint_32)65535L)
|
||||
{
|
||||
png_warning(png_ptr, "zTXt chunk too large to fit in memory");
|
||||
png_push_crc_skip(png_ptr, length);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||
(png_size_t)(length + 1));
|
||||
png_ptr->current_text[length] = '\0';
|
||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||
png_ptr->current_text_size = (png_size_t)length;
|
||||
png_ptr->current_text_left = (png_size_t)length;
|
||||
png_ptr->process_mode = PNG_READ_zTXt_MODE;
|
||||
}
|
||||
|
||||
void /* PRIVATE */
|
||||
png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
if (png_ptr->buffer_size && png_ptr->current_text_left)
|
||||
{
|
||||
png_size_t text_size;
|
||||
|
||||
if (png_ptr->buffer_size < (png_uint_32)png_ptr->current_text_left)
|
||||
text_size = png_ptr->buffer_size;
|
||||
|
||||
else
|
||||
text_size = png_ptr->current_text_left;
|
||||
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size);
|
||||
png_ptr->current_text_left -= text_size;
|
||||
png_ptr->current_text_ptr += text_size;
|
||||
}
|
||||
if (!(png_ptr->current_text_left))
|
||||
{
|
||||
png_textp text_ptr;
|
||||
png_charp text;
|
||||
png_charp key;
|
||||
int ret;
|
||||
png_size_t text_size, key_size;
|
||||
|
||||
if (png_ptr->buffer_size < 4)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
png_push_crc_finish(png_ptr);
|
||||
|
||||
key = png_ptr->current_text;
|
||||
|
||||
for (text = key; *text; text++)
|
||||
/* Empty loop */ ;
|
||||
|
||||
/* zTXt can't have zero text */
|
||||
if (text >= key + png_ptr->current_text_size)
|
||||
{
|
||||
png_ptr->current_text = NULL;
|
||||
png_free(png_ptr, key);
|
||||
return;
|
||||
}
|
||||
|
||||
text++;
|
||||
|
||||
if (*text != PNG_TEXT_COMPRESSION_zTXt) /* Check compression byte */
|
||||
{
|
||||
png_ptr->current_text = NULL;
|
||||
png_free(png_ptr, key);
|
||||
return;
|
||||
}
|
||||
|
||||
text++;
|
||||
|
||||
png_ptr->zstream.next_in = (png_bytep)text;
|
||||
png_ptr->zstream.avail_in = (uInt)(png_ptr->current_text_size -
|
||||
(text - key));
|
||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||
|
||||
key_size = text - key;
|
||||
text_size = 0;
|
||||
text = NULL;
|
||||
ret = Z_STREAM_END;
|
||||
|
||||
while (png_ptr->zstream.avail_in)
|
||||
{
|
||||
ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
|
||||
if (ret != Z_OK && ret != Z_STREAM_END)
|
||||
{
|
||||
inflateReset(&png_ptr->zstream);
|
||||
png_ptr->zstream.avail_in = 0;
|
||||
png_ptr->current_text = NULL;
|
||||
png_free(png_ptr, key);
|
||||
png_free(png_ptr, text);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(png_ptr->zstream.avail_out) || ret == Z_STREAM_END)
|
||||
{
|
||||
if (text == NULL)
|
||||
{
|
||||
text = (png_charp)png_malloc(png_ptr,
|
||||
(png_ptr->zbuf_size
|
||||
- png_ptr->zstream.avail_out + key_size + 1));
|
||||
|
||||
png_memcpy(text + key_size, png_ptr->zbuf,
|
||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
||||
|
||||
png_memcpy(text, key, key_size);
|
||||
|
||||
text_size = key_size + png_ptr->zbuf_size -
|
||||
png_ptr->zstream.avail_out;
|
||||
|
||||
*(text + text_size) = '\0';
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
png_charp tmp;
|
||||
|
||||
tmp = text;
|
||||
text = (png_charp)png_malloc(png_ptr, text_size +
|
||||
(png_ptr->zbuf_size
|
||||
- png_ptr->zstream.avail_out + 1));
|
||||
|
||||
png_memcpy(text, tmp, text_size);
|
||||
png_free(png_ptr, tmp);
|
||||
|
||||
png_memcpy(text + text_size, png_ptr->zbuf,
|
||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
||||
|
||||
text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
||||
*(text + text_size) = '\0';
|
||||
}
|
||||
|
||||
if (ret != Z_STREAM_END)
|
||||
{
|
||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret == Z_STREAM_END)
|
||||
break;
|
||||
}
|
||||
|
||||
inflateReset(&png_ptr->zstream);
|
||||
png_ptr->zstream.avail_in = 0;
|
||||
|
||||
if (ret != Z_STREAM_END)
|
||||
{
|
||||
png_ptr->current_text = NULL;
|
||||
png_free(png_ptr, key);
|
||||
png_free(png_ptr, text);
|
||||
return;
|
||||
}
|
||||
|
||||
png_ptr->current_text = NULL;
|
||||
png_free(png_ptr, key);
|
||||
key = text;
|
||||
text += key_size;
|
||||
|
||||
text_ptr = (png_textp)png_malloc(png_ptr,
|
||||
png_sizeof(png_text));
|
||||
text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||
text_ptr->key = key;
|
||||
text_ptr->itxt_length = 0;
|
||||
text_ptr->lang = NULL;
|
||||
text_ptr->lang_key = NULL;
|
||||
text_ptr->text = text;
|
||||
|
||||
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
|
||||
|
||||
png_free(png_ptr, key);
|
||||
png_free(png_ptr, text_ptr);
|
||||
|
||||
if (ret)
|
||||
png_warning(png_ptr, "Insufficient memory to store text chunk");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_iTXt_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
length)
|
||||
{
|
||||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||
{
|
||||
PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
|
||||
png_error(png_ptr, "Out of place iTXt");
|
||||
/* NOT REACHED */
|
||||
}
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
png_ptr->skip_length = 0; /* This may not be necessary */
|
||||
|
||||
if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */
|
||||
{
|
||||
png_warning(png_ptr, "iTXt chunk too large to fit in memory");
|
||||
png_ptr->skip_length = length - (png_uint_32)65535L;
|
||||
length = (png_uint_32)65535L;
|
||||
}
|
||||
#endif
|
||||
|
||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||
(png_size_t)(length + 1));
|
||||
png_ptr->current_text[length] = '\0';
|
||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||
png_ptr->current_text_size = (png_size_t)length;
|
||||
png_ptr->current_text_left = (png_size_t)length;
|
||||
png_ptr->process_mode = PNG_READ_iTXt_MODE;
|
||||
}
|
||||
|
||||
void /* PRIVATE */
|
||||
png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
|
||||
if (png_ptr->buffer_size && png_ptr->current_text_left)
|
||||
{
|
||||
png_size_t text_size;
|
||||
|
||||
if (png_ptr->buffer_size < png_ptr->current_text_left)
|
||||
text_size = png_ptr->buffer_size;
|
||||
|
||||
else
|
||||
text_size = png_ptr->current_text_left;
|
||||
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size);
|
||||
png_ptr->current_text_left -= text_size;
|
||||
png_ptr->current_text_ptr += text_size;
|
||||
}
|
||||
|
||||
if (!(png_ptr->current_text_left))
|
||||
{
|
||||
png_textp text_ptr;
|
||||
png_charp key;
|
||||
int comp_flag;
|
||||
png_charp lang;
|
||||
png_charp lang_key;
|
||||
png_charp text;
|
||||
int ret;
|
||||
|
||||
if (png_ptr->buffer_size < 4)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
png_push_crc_finish(png_ptr);
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
if (png_ptr->skip_length)
|
||||
return;
|
||||
#endif
|
||||
|
||||
key = png_ptr->current_text;
|
||||
|
||||
for (lang = key; *lang; lang++)
|
||||
/* Empty loop */ ;
|
||||
|
||||
if (lang < key + png_ptr->current_text_size - 3)
|
||||
lang++;
|
||||
|
||||
comp_flag = *lang++;
|
||||
lang++; /* Skip comp_type, always zero */
|
||||
|
||||
for (lang_key = lang; *lang_key; lang_key++)
|
||||
/* Empty loop */ ;
|
||||
|
||||
lang_key++; /* Skip NUL separator */
|
||||
|
||||
text=lang_key;
|
||||
|
||||
if (lang_key < key + png_ptr->current_text_size - 1)
|
||||
{
|
||||
for (; *text; text++)
|
||||
/* Empty loop */ ;
|
||||
}
|
||||
|
||||
if (text < key + png_ptr->current_text_size)
|
||||
text++;
|
||||
|
||||
text_ptr = (png_textp)png_malloc(png_ptr,
|
||||
png_sizeof(png_text));
|
||||
|
||||
text_ptr->compression = comp_flag + 2;
|
||||
text_ptr->key = key;
|
||||
text_ptr->lang = lang;
|
||||
text_ptr->lang_key = lang_key;
|
||||
text_ptr->text = text;
|
||||
text_ptr->text_length = 0;
|
||||
text_ptr->itxt_length = png_strlen(text);
|
||||
|
||||
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
|
||||
|
||||
png_ptr->current_text = NULL;
|
||||
|
||||
png_free(png_ptr, text_ptr);
|
||||
if (ret)
|
||||
png_warning(png_ptr, "Insufficient memory to store iTXt chunk");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function is called when we haven't found a handler for this
|
||||
* chunk. If there isn't a problem with the chunk itself (ie a bad chunk
|
||||
* name or a critical chunk), the chunk is (currently) silently ignored.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
length)
|
||||
{
|
||||
png_uint_32 skip = 0;
|
||||
png_uint_32 chunk_name = png_ptr->chunk_name;
|
||||
|
||||
if (PNG_CHUNK_CRITICAL(chunk_name))
|
||||
{
|
||||
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
if (png_chunk_unknown_handling(png_ptr, chunk_name) !=
|
||||
PNG_HANDLE_CHUNK_ALWAYS
|
||||
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
&& png_ptr->read_user_chunk_fn == NULL
|
||||
#endif
|
||||
)
|
||||
#endif
|
||||
png_chunk_error(png_ptr, "unknown critical chunk");
|
||||
|
||||
PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
/* TODO: the code below is apparently just using the
|
||||
* png_struct::unknown_chunk member as a temporarily variable, it should be
|
||||
* possible to eliminate both it and the temporary buffer.
|
||||
*/
|
||||
if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
|
||||
{
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
if (length > 65535)
|
||||
{
|
||||
png_warning(png_ptr, "unknown chunk too large to fit in memory");
|
||||
skip = length - 65535;
|
||||
length = 65535;
|
||||
}
|
||||
#endif
|
||||
/* This is just a record for the user; libpng doesn't use the character
|
||||
* form of the name.
|
||||
*/
|
||||
PNG_CSTRING_FROM_CHUNK(png_ptr->unknown_chunk.name, png_ptr->chunk_name);
|
||||
|
||||
/* The following cast should be safe because of the check above. */
|
||||
png_ptr->unknown_chunk.size = (png_size_t)length;
|
||||
|
||||
if (length == 0)
|
||||
png_ptr->unknown_chunk.data = NULL;
|
||||
|
||||
else
|
||||
{
|
||||
png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr,
|
||||
png_ptr->unknown_chunk.size);
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data,
|
||||
png_ptr->unknown_chunk.size);
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
if (png_ptr->read_user_chunk_fn != NULL)
|
||||
{
|
||||
/* Callback to user unknown chunk handler */
|
||||
int ret;
|
||||
ret = (*(png_ptr->read_user_chunk_fn))
|
||||
(png_ptr, &png_ptr->unknown_chunk);
|
||||
|
||||
if (ret < 0)
|
||||
png_chunk_error(png_ptr, "error in user chunk");
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
if (PNG_CHUNK_CRITICAL(png_ptr->chunk_name))
|
||||
if (png_chunk_unknown_handling(png_ptr, chunk_name) !=
|
||||
PNG_HANDLE_CHUNK_ALWAYS)
|
||||
png_chunk_error(png_ptr, "unknown critical chunk");
|
||||
png_set_unknown_chunks(png_ptr, info_ptr,
|
||||
&png_ptr->unknown_chunk, 1);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
#endif
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
|
||||
png_free(png_ptr, png_ptr->unknown_chunk.data);
|
||||
png_ptr->unknown_chunk.data = NULL;
|
||||
}
|
||||
|
||||
else
|
||||
#endif
|
||||
skip=length;
|
||||
png_push_crc_skip(png_ptr, skip);
|
||||
}
|
||||
|
||||
void /* PRIVATE */
|
||||
png_push_have_info(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2012 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.)
|
||||
*
|
||||
* Last changed in libpng 1.5.7 [December 15, 2011]
|
||||
* Last changed in libpng 1.5.10 [March 29, 2012]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
|
@ -133,6 +133,46 @@
|
|||
# define PNG_DLL_EXPORT
|
||||
#endif
|
||||
|
||||
/* SECURITY and SAFETY:
|
||||
*
|
||||
* By default libpng is built without any internal limits on image size,
|
||||
* individual heap (png_malloc) allocations or the total amount of memory used.
|
||||
* If PNG_SAFE_LIMITS_SUPPORTED is defined, however, the limits below are used
|
||||
* (unless individually overridden). These limits are believed to be fairly
|
||||
* safe, but builders of secure systems should verify the values against the
|
||||
* real system capabilities.
|
||||
*/
|
||||
|
||||
#ifdef PNG_SAFE_LIMITS_SUPPORTED
|
||||
/* 'safe' limits */
|
||||
# ifndef PNG_USER_WIDTH_MAX
|
||||
# define PNG_USER_WIDTH_MAX 1000000
|
||||
# endif
|
||||
# ifndef PNG_USER_HEIGHT_MAX
|
||||
# define PNG_USER_HEIGHT_MAX 1000000
|
||||
# endif
|
||||
# ifndef PNG_USER_CHUNK_CACHE_MAX
|
||||
# define PNG_USER_CHUNK_CACHE_MAX 128
|
||||
# endif
|
||||
# ifndef PNG_USER_CHUNK_MALLOC_MAX
|
||||
# define PNG_USER_CHUNK_MALLOC_MAX 8000000
|
||||
# endif
|
||||
#else
|
||||
/* values for no limits */
|
||||
# ifndef PNG_USER_WIDTH_MAX
|
||||
# define PNG_USER_WIDTH_MAX 0x7fffffff
|
||||
# endif
|
||||
# ifndef PNG_USER_HEIGHT_MAX
|
||||
# define PNG_USER_HEIGHT_MAX 0x7fffffff
|
||||
# endif
|
||||
# ifndef PNG_USER_CHUNK_CACHE_MAX
|
||||
# define PNG_USER_CHUNK_CACHE_MAX 0
|
||||
# endif
|
||||
# ifndef PNG_USER_CHUNK_MALLOC_MAX
|
||||
# define PNG_USER_CHUNK_MALLOC_MAX 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* This is used for 16 bit gamma tables - only the top level pointers are const,
|
||||
* this could be changed:
|
||||
*/
|
||||
|
@ -426,6 +466,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
|
|||
#define PNG_BACKGROUND_IS_GRAY 0x800
|
||||
#define PNG_HAVE_PNG_SIGNATURE 0x1000
|
||||
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
|
||||
#define PNG_HAVE_iCCP 0x4000
|
||||
|
||||
/* Flags for the transformations the PNG library does on the image data */
|
||||
#define PNG_BGR 0x0001
|
||||
|
@ -1218,10 +1259,8 @@ PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
|
|||
png_uint_32 length));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||
PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
|
||||
png_infop info_ptr, png_uint_32 length));
|
||||
#endif
|
||||
|
||||
PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
|
||||
png_uint_32 chunk_name));
|
||||
|
@ -1355,6 +1394,13 @@ PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
|
|||
int color_type, int interlace_type, int compression_type,
|
||||
int filter_type));
|
||||
|
||||
/* Added at libpng version 1.5.10 */
|
||||
#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
|
||||
defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
|
||||
PNG_EXTERN void png_do_check_palette_indexes PNGARG((png_structp png_ptr,
|
||||
png_row_infop row_info));
|
||||
#endif
|
||||
|
||||
/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
|
||||
PNG_EXTERN void png_read_destroy PNGARG((png_structp png_ptr,
|
||||
png_infop info_ptr, png_infop end_info_ptr));
|
||||
|
@ -1536,7 +1582,7 @@ PNG_EXTERN void png_ascii_from_fixed PNGARG((png_structp png_ptr,
|
|||
#define PNG_FP_IS_ZERO(state) (((state) & PNG_FP_Z_MASK) == PNG_FP_SAW_DIGIT)
|
||||
#define PNG_FP_IS_POSITIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_Z_MASK)
|
||||
#define PNG_FP_IS_NEGATIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_NZ_MASK)
|
||||
|
||||
|
||||
/* The actual parser. This can be called repeatedly, it updates
|
||||
* the index into the string and the state variable (which must
|
||||
* be initialzed to 0). It returns a result code, as above. There
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.5.7 [December 15, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.10 [March 8, 2012]
|
||||
* Copyright (c) 1998-2012 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.)
|
||||
*
|
||||
|
@ -67,15 +67,11 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
|
|||
png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
|
||||
png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
|
||||
|
||||
# ifdef PNG_USER_CHUNK_CACHE_MAX
|
||||
/* Added at libpng-1.2.43 and 1.4.0 */
|
||||
png_ptr->user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
|
||||
# endif
|
||||
|
||||
# ifdef PNG_SET_USER_CHUNK_MALLOC_MAX
|
||||
/* Added at libpng-1.2.43 and 1.4.1 */
|
||||
png_ptr->user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
|
@ -805,6 +801,13 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
|
|||
|
||||
png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */
|
||||
|
||||
#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
/* Report invalid palette index; added at libng-1.5.10 */
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
|
||||
png_ptr->num_palette_max > png_ptr->num_palette)
|
||||
png_benign_error(png_ptr, "Read palette index exceeding num_palette");
|
||||
#endif
|
||||
|
||||
do
|
||||
{
|
||||
png_uint_32 length = png_read_chunk_header(png_ptr);
|
||||
|
@ -1070,12 +1073,6 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr,
|
|||
png_free(png_ptr, png_ptr->save_buffer);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||
#ifdef PNG_TEXT_SUPPORTED
|
||||
png_free(png_ptr, png_ptr->current_text);
|
||||
#endif /* PNG_TEXT_SUPPORTED */
|
||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||
|
||||
/* Save the important info out of the png_struct, in case it is
|
||||
* being used again.
|
||||
*/
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.5.7 [December 15, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.11 [June 14, 2012]
|
||||
* Copyright (c) 1998-2012 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.)
|
||||
*
|
||||
|
@ -1770,8 +1770,8 @@ png_init_read_transformations(png_structp png_ptr)
|
|||
int num_palette = png_ptr->num_palette;
|
||||
int i;
|
||||
|
||||
/*NOTE: there are other transformations that should probably be in here
|
||||
* too.
|
||||
/* NOTE: there are other transformations that should probably be in
|
||||
* here too.
|
||||
*/
|
||||
for (i = 0; i < num_palette; i++)
|
||||
{
|
||||
|
@ -1830,12 +1830,15 @@ png_init_read_transformations(png_structp png_ptr)
|
|||
|
||||
#ifdef PNG_READ_SHIFT_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_SHIFT) &&
|
||||
!(png_ptr->transformations & PNG_EXPAND) &&
|
||||
(png_ptr->color_type == PNG_COLOR_TYPE_PALETTE))
|
||||
{
|
||||
int i;
|
||||
int istop = png_ptr->num_palette;
|
||||
int shift = 8 - png_ptr->sig_bit.red;
|
||||
|
||||
png_ptr->transformations &= ~PNG_SHIFT;
|
||||
|
||||
/* significant bits can be in the range 1 to 7 for a meaninful result, if
|
||||
* the number of significant bits is 0 then no shift is done (this is an
|
||||
* error condition which is silently ignored.)
|
||||
|
@ -2274,7 +2277,7 @@ png_do_read_transformations(png_structp png_ptr, png_row_infop row_info)
|
|||
#endif
|
||||
|
||||
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||
/*NOTE: moved here in 1.5.4 (from much later in this list.) */
|
||||
/* NOTE: moved here in 1.5.4 (from much later in this list.) */
|
||||
if ((png_ptr->transformations & PNG_GRAY_TO_RGB) &&
|
||||
(png_ptr->mode & PNG_BACKGROUND_IS_GRAY))
|
||||
png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
|
||||
|
@ -2296,6 +2299,13 @@ png_do_read_transformations(png_structp png_ptr, png_row_infop row_info)
|
|||
png_do_unpack(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
/* Added at libpng-1.5.10 */
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_PALETTE &&
|
||||
png_ptr->num_palette_max >= 0)
|
||||
png_do_check_palette_indexes(png_ptr, row_info);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_BGR_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_BGR)
|
||||
png_do_bgr(row_info, png_ptr->row_buf + 1);
|
||||
|
@ -3293,7 +3303,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
|
|||
if (red != green || red != blue)
|
||||
{
|
||||
rgb_error |= 1;
|
||||
/*NOTE: this is the historical approach which simply
|
||||
/* NOTE: this is the historical approach which simply
|
||||
* truncates the results.
|
||||
*/
|
||||
*(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.5.7 [December 15, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.10 [March 8, 2012]
|
||||
* Copyright (c) 1998-2012 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.)
|
||||
*
|
||||
|
@ -432,15 +432,16 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||
/* Now check the limits on this chunk - if the limit fails the
|
||||
* compressed data will be removed, the prefix will remain.
|
||||
*/
|
||||
#ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||
if (png_ptr->user_chunk_malloc_max &&
|
||||
if (prefix_size >= (~(png_size_t)0) - 1 ||
|
||||
expanded_size >= (~(png_size_t)0) - 1 - prefix_size
|
||||
#ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
|| (png_ptr->user_chunk_malloc_max &&
|
||||
(prefix_size + expanded_size >= png_ptr->user_chunk_malloc_max - 1))
|
||||
#else
|
||||
# ifdef PNG_USER_CHUNK_MALLOC_MAX
|
||||
if ((PNG_USER_CHUNK_MALLOC_MAX > 0) &&
|
||||
|| ((PNG_USER_CHUNK_MALLOC_MAX > 0) &&
|
||||
prefix_size + expanded_size >= PNG_USER_CHUNK_MALLOC_MAX - 1)
|
||||
# endif
|
||||
#endif
|
||||
)
|
||||
png_warning(png_ptr, "Exceeded size limit while expanding chunk");
|
||||
|
||||
/* If the size is zero either there was an error and a message
|
||||
|
@ -448,12 +449,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
|||
* and we have nothing to do - the code will exit through the
|
||||
* error case below.
|
||||
*/
|
||||
#if defined(PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED) || \
|
||||
defined(PNG_USER_CHUNK_MALLOC_MAX)
|
||||
else if (expanded_size > 0)
|
||||
#else
|
||||
if (expanded_size > 0)
|
||||
#endif
|
||||
{
|
||||
/* Success (maybe) - really uncompress the chunk. */
|
||||
png_size_t new_size = 0;
|
||||
|
@ -1261,13 +1257,16 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
/* Should be an error, but we can cope with it */
|
||||
png_warning(png_ptr, "Out of place iCCP chunk");
|
||||
|
||||
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP))
|
||||
if ((png_ptr->mode & PNG_HAVE_iCCP) || (info_ptr != NULL &&
|
||||
(info_ptr->valid & (PNG_INFO_iCCP|PNG_INFO_sRGB))))
|
||||
{
|
||||
png_warning(png_ptr, "Duplicate iCCP chunk");
|
||||
png_crc_finish(png_ptr, length);
|
||||
return;
|
||||
}
|
||||
|
||||
png_ptr->mode |= PNG_HAVE_iCCP;
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
if (length > (png_uint_32)65535L)
|
||||
{
|
||||
|
@ -1279,7 +1278,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
|
||||
slength = (png_size_t)length;
|
||||
slength = length;
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
|
||||
|
||||
if (png_crc_finish(png_ptr, skip))
|
||||
|
@ -1429,7 +1428,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
* that the PNG_MAX_MALLOC_64K test is enabled in this case, but this is a
|
||||
* potential breakage point if the types in pngconf.h aren't exactly right.
|
||||
*/
|
||||
slength = (png_size_t)length;
|
||||
slength = length;
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
|
||||
|
||||
if (png_crc_finish(png_ptr, skip))
|
||||
|
@ -1797,16 +1796,16 @@ png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
return;
|
||||
}
|
||||
|
||||
num = length / 2 ;
|
||||
|
||||
if (num != (unsigned int)png_ptr->num_palette || num >
|
||||
(unsigned int)PNG_MAX_PALETTE_LENGTH)
|
||||
if (length > 2*PNG_MAX_PALETTE_LENGTH ||
|
||||
length != (unsigned int) (2*png_ptr->num_palette))
|
||||
{
|
||||
png_warning(png_ptr, "Incorrect hIST chunk length");
|
||||
png_crc_finish(png_ptr, length);
|
||||
return;
|
||||
}
|
||||
|
||||
num = length / 2 ;
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
png_byte buf[2];
|
||||
|
@ -1956,7 +1955,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
return;
|
||||
}
|
||||
|
||||
slength = (png_size_t)length;
|
||||
slength = length;
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
|
||||
|
||||
if (png_crc_finish(png_ptr, 0))
|
||||
|
@ -2105,7 +2104,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
return;
|
||||
}
|
||||
|
||||
slength = (png_size_t)length;
|
||||
slength = length;
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
|
||||
png_ptr->chunkdata[slength] = 0x00; /* Null terminate the last string */
|
||||
|
||||
|
@ -2265,7 +2264,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
return;
|
||||
}
|
||||
|
||||
slength = (png_size_t)length;
|
||||
slength = length;
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
|
||||
|
||||
if (png_crc_finish(png_ptr, skip))
|
||||
|
@ -2373,7 +2372,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
return;
|
||||
}
|
||||
|
||||
slength = (png_size_t)length;
|
||||
slength = length;
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
|
||||
|
||||
if (png_crc_finish(png_ptr, 0))
|
||||
|
@ -2504,7 +2503,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||
return;
|
||||
}
|
||||
|
||||
slength = (png_size_t)length;
|
||||
slength = length;
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
|
||||
|
||||
if (png_crc_finish(png_ptr, 0))
|
||||
|
@ -3707,7 +3706,7 @@ png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
|||
{
|
||||
pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_neon;
|
||||
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_neon;
|
||||
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
|
||||
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
|
||||
png_read_filter_row_paeth3_neon;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.5.7 [December 15, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.11 [June 14, 2012]
|
||||
* Copyright (c) 1998-2012 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.)
|
||||
*
|
||||
|
@ -149,7 +149,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
|
|||
* possible for 1/gamma to overflow the limit of 21474 and this means the
|
||||
* gamma value must be at least 5/100000 and hence at most 20000.0. For
|
||||
* safety the limits here are a little narrower. The values are 0.00016 to
|
||||
* 6250.0, which are truly ridiculous gammma values (and will produce
|
||||
* 6250.0, which are truly ridiculous gamma values (and will produce
|
||||
* displays that are all black or all white.)
|
||||
*/
|
||||
if (file_gamma < 16 || file_gamma > 625000000)
|
||||
|
@ -692,24 +692,28 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr,
|
|||
*/
|
||||
if (info_ptr->num_text + num_text > info_ptr->max_text)
|
||||
{
|
||||
int old_max_text = info_ptr->max_text;
|
||||
int old_num_text = info_ptr->num_text;
|
||||
|
||||
if (info_ptr->text != NULL)
|
||||
{
|
||||
png_textp old_text;
|
||||
int old_max;
|
||||
|
||||
old_max = info_ptr->max_text;
|
||||
info_ptr->max_text = info_ptr->num_text + num_text + 8;
|
||||
old_text = info_ptr->text;
|
||||
|
||||
info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
|
||||
(png_size_t)(info_ptr->max_text * png_sizeof(png_text)));
|
||||
|
||||
if (info_ptr->text == NULL)
|
||||
{
|
||||
png_free(png_ptr, old_text);
|
||||
/* Restore to previous condition */
|
||||
info_ptr->max_text = old_max_text;
|
||||
info_ptr->text = old_text;
|
||||
return(1);
|
||||
}
|
||||
|
||||
png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max *
|
||||
png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max_text *
|
||||
png_sizeof(png_text)));
|
||||
png_free(png_ptr, old_text);
|
||||
}
|
||||
|
@ -721,7 +725,12 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr,
|
|||
info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
|
||||
(png_size_t)(info_ptr->max_text * png_sizeof(png_text)));
|
||||
if (info_ptr->text == NULL)
|
||||
{
|
||||
/* Restore to previous condition */
|
||||
info_ptr->num_text = old_num_text;
|
||||
info_ptr->max_text = old_max_text;
|
||||
return(1);
|
||||
}
|
||||
info_ptr->free_me |= PNG_FREE_TEXT;
|
||||
}
|
||||
|
||||
|
@ -1281,4 +1290,22 @@ png_set_benign_errors(png_structp png_ptr, int allowed)
|
|||
png_ptr->flags &= ~PNG_FLAG_BENIGN_ERRORS_WARN;
|
||||
}
|
||||
#endif /* PNG_BENIGN_ERRORS_SUPPORTED */
|
||||
|
||||
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
/* Whether to report invalid palette index; added at libng-1.5.10
|
||||
* allowed - one of 0: disable; 1: enable
|
||||
*/
|
||||
void PNGAPI
|
||||
png_set_check_for_invalid_index(png_structp png_ptr, int allowed)
|
||||
{
|
||||
png_debug(1, "in png_set_check_for_invalid_index");
|
||||
|
||||
if (allowed)
|
||||
png_ptr->num_palette_max = 0;
|
||||
|
||||
else
|
||||
png_ptr->num_palette_max = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
/* pngstruct.h - header file for PNG reference library
|
||||
*
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2012 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.)
|
||||
*
|
||||
* Last changed in libpng 1.5.5 [September 22, 2011]
|
||||
* Last changed in libpng 1.5.9 [February 18, 2012]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
|
@ -121,6 +121,12 @@ struct png_struct_def
|
|||
png_uint_32 crc; /* current chunk CRC value */
|
||||
png_colorp palette; /* palette from the input file */
|
||||
png_uint_16 num_palette; /* number of color entries in palette */
|
||||
|
||||
/* Added at libpng-1.5.10 */
|
||||
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
int num_palette_max; /* maximum palette index found in IDAT */
|
||||
#endif
|
||||
|
||||
png_uint_16 num_trans; /* number of transparency values */
|
||||
png_byte compression; /* file compression type (always 0) */
|
||||
png_byte filter; /* file filter type (always 0) */
|
||||
|
@ -211,13 +217,6 @@ struct png_struct_def
|
|||
int process_mode; /* what push library is currently doing */
|
||||
int cur_palette; /* current push library palette index */
|
||||
|
||||
# ifdef PNG_TEXT_SUPPORTED
|
||||
png_size_t current_text_size; /* current size of text input data */
|
||||
png_size_t current_text_left; /* how much text left to read in input */
|
||||
png_charp current_text; /* current text chunk buffer */
|
||||
png_charp current_text_ptr; /* current location in current_text */
|
||||
# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
|
||||
|
||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||
|
||||
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
||||
|
@ -249,6 +248,7 @@ struct png_struct_def
|
|||
#endif
|
||||
|
||||
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
||||
/* This is going to be unused in libpng16 and removed from libpng17 */
|
||||
char time_buffer[29]; /* String to hold RFC 1123 time text */
|
||||
#endif
|
||||
|
||||
|
@ -283,9 +283,7 @@ struct png_struct_def
|
|||
#endif
|
||||
|
||||
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
|
||||
#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
|
||||
defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
|
||||
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
|
||||
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||
/* Changed from png_byte to png_uint_32 at version 1.2.0 */
|
||||
png_uint_32 mng_features_permitted;
|
||||
#endif
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.5.4 [July 7, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.5.11 [June 14, 2012]
|
||||
* Copyright (c) 1998-2012 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.)
|
||||
*
|
||||
|
@ -619,6 +619,109 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||
}
|
||||
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
|
||||
|
||||
#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
|
||||
defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
|
||||
/* Added at libpng-1.5.10 */
|
||||
void /* PRIVATE */
|
||||
png_do_check_palette_indexes(png_structp png_ptr, png_row_infop row_info)
|
||||
{
|
||||
if (png_ptr->num_palette < (1 << row_info->bit_depth) &&
|
||||
png_ptr->num_palette > 0) /* num_palette can be 0 in MNG files */
|
||||
{
|
||||
/* Calculations moved outside switch in an attempt to stop different
|
||||
* compiler warnings. 'padding' is in *bits* within the last byte, it is
|
||||
* an 'int' because pixel_depth becomes an 'int' in the expression below,
|
||||
* and this calculation is used because it avoids warnings that other
|
||||
* forms produced on either GCC or MSVC.
|
||||
*/
|
||||
int padding = (-row_info->pixel_depth * row_info->width) & 7;
|
||||
png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
|
||||
|
||||
switch (row_info->bit_depth)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
/* in this case, all bytes must be 0 so we don't need
|
||||
* to unpack the pixels except for the rightmost one.
|
||||
*/
|
||||
for (; rp > png_ptr->row_buf; rp--)
|
||||
{
|
||||
if (*rp >> padding != 0)
|
||||
png_ptr->num_palette_max = 1;
|
||||
padding = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
for (; rp > png_ptr->row_buf; rp--)
|
||||
{
|
||||
int i = ((*rp >> padding) & 0x03);
|
||||
|
||||
if (i > png_ptr->num_palette_max)
|
||||
png_ptr->num_palette_max = i;
|
||||
|
||||
i = (((*rp >> padding) >> 2) & 0x03);
|
||||
|
||||
if (i > png_ptr->num_palette_max)
|
||||
png_ptr->num_palette_max = i;
|
||||
|
||||
i = (((*rp >> padding) >> 4) & 0x03);
|
||||
|
||||
if (i > png_ptr->num_palette_max)
|
||||
png_ptr->num_palette_max = i;
|
||||
|
||||
i = (((*rp >> padding) >> 6) & 0x03);
|
||||
|
||||
if (i > png_ptr->num_palette_max)
|
||||
png_ptr->num_palette_max = i;
|
||||
|
||||
padding = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 4:
|
||||
{
|
||||
for (; rp > png_ptr->row_buf; rp--)
|
||||
{
|
||||
int i = ((*rp >> padding) & 0x0f);
|
||||
|
||||
if (i > png_ptr->num_palette_max)
|
||||
png_ptr->num_palette_max = i;
|
||||
|
||||
i = (((*rp >> padding) >> 4) & 0x0f);
|
||||
|
||||
if (i > png_ptr->num_palette_max)
|
||||
png_ptr->num_palette_max = i;
|
||||
|
||||
padding = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 8:
|
||||
{
|
||||
for (; rp > png_ptr->row_buf; rp--)
|
||||
{
|
||||
if (*rp > png_ptr->num_palette_max)
|
||||
png_ptr->num_palette_max = (int) *rp;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED */
|
||||
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
||||
|
|
Loading…
Reference in a new issue