mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-04 21:34:41 +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 @@
|
|||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue