mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1311776 - Update in-tree libpng to version 1.6.26. r=jrmuizel
This commit is contained in:
parent
0b6357492a
commit
632f7ac5b5
@ -593,7 +593,7 @@ Version 1.0.5e [November 30, 1999]
|
||||
with trailing compressed parts easier in the future, and added new functions
|
||||
png_free_iCCP, png_free_pCAL, png_free_sPLT, png_free_text, png_get_iCCP,
|
||||
png_get_spalettes, png_set_iCCP, png_set_spalettes (Eric S. Raymond).
|
||||
NOTE: Applications that write text chunks MUST define png_text->lang
|
||||
NOTE: Applications that write text chunks MUST define png_text->lang
|
||||
before calling png_set_text(). It must be set to NULL if you want to
|
||||
write tEXt or zTXt chunks. If you want your application to be able to
|
||||
run with older versions of libpng, use
|
||||
@ -5703,6 +5703,57 @@ Version 1.6.25rc05 [August 30, 2016]
|
||||
Version 1.6.25 [September 1, 2016]
|
||||
No changes.
|
||||
|
||||
Version 1.6.26beta01 [September 26, 2016]
|
||||
Fixed handling zero length IDAT in pngfix (bug report by Agostino Sarubbo,
|
||||
bugfix by John Bowler).
|
||||
Do not issue a png_error() on read in png_set_pCAL() because png_handle_pCAL
|
||||
has allocated memory that libpng needs to free.
|
||||
Conditionally compile png_set_benign_errors() in pngread.c and pngtest.c
|
||||
Issue a png_benign_error instead of a png_error on ADLER32 mismatch
|
||||
while decoding compressed data chunks.
|
||||
Changed PNG_ZLIB_VERNUM to ZLIB_VERNUM in pngpriv.h, pngstruct.h, and
|
||||
pngrutil.c.
|
||||
If CRC handling of critical chunks has been set to PNG_CRC_QUIET_USE,
|
||||
ignore the ADLER32 checksum in the IDAT chunk as well as the chunk CRCs.
|
||||
Issue png_benign_error() on ADLER32 checksum mismatch instead of png_error().
|
||||
Add tests/badcrc.png and tests/badadler.png to tests/pngtest.
|
||||
Merged pngtest.c with libpng-1.7.0beta84/pngtest.c
|
||||
|
||||
Version 1.6.26beta02 [October 1, 2016]
|
||||
Updated the documentation about CRC and ADLER32 handling.
|
||||
Quieted 117 warnings from clang-3.8 in pngtrans.c, pngread.c,
|
||||
pngwrite.c, pngunknown.c, and pngvalid.c.
|
||||
Quieted 58 (out of 144) -Wconversion compiler warnings by changing
|
||||
flag definitions in pngpriv.h from 0xnnnn to 0xnnnnU and trivial changes
|
||||
in png.c, pngread.c, and pngwutil.c.
|
||||
|
||||
Version 1.6.26beta03 [October 2, 2016]
|
||||
Removed contrib/libtests/*.orig and *.rej that slipped into the tarballs.
|
||||
Quieted the 86 remaining -Wconversion compiler warnings by
|
||||
revising the png_isaligned() macro and trivial changes in png.c,
|
||||
pngerror.c, pngget.c, pngmem.c, pngset.c, pngrtran.c, pngrutil.c,
|
||||
pngwtran.c, pngwrite.c, and pngwutil.c.
|
||||
|
||||
Version 1.6.26beta04 [October 3, 2016]
|
||||
Quieted (bogus?) clang warnings about "absolute value has no effect"
|
||||
when PNG_USE_ABS is defined.
|
||||
Fixed offsets in contrib/intel/intel_sse.patch
|
||||
|
||||
Version 1.6.26beta05 [October 6, 2016]
|
||||
Changed integer constant 4294967294 to unsigned 4294967294U in pngconf.h
|
||||
to avoid a signed/unsigned compare in the preprocessor.
|
||||
|
||||
Version 1.6.26beta06 [October 7, 2016]
|
||||
Use zlib-1.2.8.1 inflateValidate() instead of inflateReset2() to
|
||||
optionally avoid ADLER32 evaluation.
|
||||
|
||||
Version 1.6.26rc01 [October 12, 2016]
|
||||
No changes.
|
||||
|
||||
Version 1.6.26 [October 20, 2016]
|
||||
Cosmetic change, "ptr != 0" to "ptr != NULL" in png.c and pngrutil.c
|
||||
Despammed email addresses (replaced "@" with " at ").
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
|
@ -26,7 +26,7 @@ Copyright (c) 2016 Google, Inc., and consist of the source files in the
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.25, September 1, 2016 are
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.26, Octoaber 20, 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
|
||||
@ -143,4 +143,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
September 1, 2016
|
||||
October 20, 2016
|
||||
|
@ -1,6 +1,8 @@
|
||||
|
||||
Changes made to pristine libpng source by mozilla.org developers.
|
||||
|
||||
2016/10/20 -- Synced with libpng-1.6.26 (bug #1311776).
|
||||
|
||||
2016/09/01 -- Synced with libpng-1.6.25 (bug #1299590).
|
||||
|
||||
2016/08/11 -- Enabled SSE2 support (bug #1276127).
|
||||
|
@ -1,4 +1,4 @@
|
||||
README for libpng version 1.6.25 - September 1, 2016 (shared library 16.0)
|
||||
README for libpng version 1.6.26 - October 20, 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.
|
||||
|
@ -14,7 +14,7 @@ Index: LICENSE
|
||||
+
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.25, September 1, 2016 are
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.26, October 20, 2016 are
|
||||
Index: pngread.c
|
||||
===================================================================
|
||||
--- pngread.c
|
||||
@ -299,8 +299,8 @@ Index: png.c
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
- "libpng version 1.6.25 - September 1, 2016" PNG_STRING_NEWLINE \
|
||||
+ "libpng version 1.6.25+apng - September 1, 2016" PNG_STRING_NEWLINE \
|
||||
- "libpng version 1.6.26 - October 20, 2016" PNG_STRING_NEWLINE \
|
||||
+ "libpng version 1.6.26+apng - October 20, 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 \
|
||||
@ -310,8 +310,8 @@ Index: png.c
|
||||
+ "Portions Copyright (c) 2006-2007 Andrew Smith" PNG_STRING_NEWLINE \
|
||||
+ "Portions Copyright (c) 2008-2016 Max Stepin" PNG_STRING_NEWLINE ;
|
||||
# else
|
||||
- return "libpng version 1.6.25 - September 1, 2016\
|
||||
+ return "libpng version 1.6.25+apng - September 1, 2016\
|
||||
- return "libpng version 1.6.26 - October 20, 2016\
|
||||
+ return "libpng version 1.6.26+apng - October 20, 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.";
|
||||
@ -342,11 +342,11 @@ Index: png.h
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
-#define PNG_LIBPNG_VER_STRING "1.6.25"
|
||||
-#define PNG_HEADER_VERSION_STRING " libpng version 1.6.25 - September 1, 2016\n"
|
||||
+#define PNG_LIBPNG_VER_STRING "1.6.25+apng"
|
||||
-#define PNG_LIBPNG_VER_STRING "1.6.26"
|
||||
-#define PNG_HEADER_VERSION_STRING " libpng version 1.6.26 - October 20, 2016\n"
|
||||
+#define PNG_LIBPNG_VER_STRING "1.6.26+apng"
|
||||
+#define PNG_HEADER_VERSION_STRING \
|
||||
+ " libpng version 1.6.25+apng - September 1, 2016\n"
|
||||
+ " libpng version 1.6.26+apng - October 20, 2016\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
@ -493,18 +493,18 @@ Index: pngpriv.h
|
||||
===================================================================
|
||||
--- pngpriv.h
|
||||
+++ pngpriv.h
|
||||
@@ -566,6 +566,10 @@
|
||||
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
|
||||
/* 0x4000 (unused) */
|
||||
#define PNG_IS_READ_STRUCT 0x8000 /* Else is a write struct */
|
||||
@@ -567,6 +567,10 @@
|
||||
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
|
||||
/* 0x4000U (unused) */
|
||||
#define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */
|
||||
+#ifdef PNG_APNG_SUPPORTED
|
||||
+#define PNG_HAVE_acTL 0x10000
|
||||
+#define PNG_HAVE_fcTL 0x20000
|
||||
+#define PNG_HAVE_acTL 0x10000U
|
||||
+#define PNG_HAVE_fcTL 0x20000U
|
||||
+#endif
|
||||
|
||||
/* Flags for the transformations the PNG library does on the image data */
|
||||
#define PNG_BGR 0x0001
|
||||
@@ -783,6 +787,16 @@
|
||||
#define PNG_BGR 0x0001U
|
||||
@@ -802,6 +806,16 @@
|
||||
#define png_tRNS PNG_U32(116, 82, 78, 83)
|
||||
#define png_zTXt PNG_U32(122, 84, 88, 116)
|
||||
|
||||
@ -514,14 +514,14 @@ Index: pngpriv.h
|
||||
+#define png_fdAT PNG_U32(102, 100, 65, 84)
|
||||
+
|
||||
+/* For png_struct.apng_flags: */
|
||||
+#define PNG_FIRST_FRAME_HIDDEN 0x0001
|
||||
+#define PNG_APNG_APP 0x0002
|
||||
+#define PNG_FIRST_FRAME_HIDDEN 0x0001U
|
||||
+#define PNG_APNG_APP 0x0002U
|
||||
+#endif
|
||||
+
|
||||
/* The following will work on (signed char*) strings, whereas the get_uint_32
|
||||
* macro will fail on top-bit-set values because of the sign extension.
|
||||
*/
|
||||
@@ -1489,6 +1503,49 @@
|
||||
@@ -1508,6 +1522,49 @@
|
||||
|
||||
#endif /* PROGRESSIVE_READ */
|
||||
|
||||
@ -653,7 +653,7 @@ Index: pngwrite.c
|
||||
#ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
if (png_ptr->num_palette_max > png_ptr->num_palette)
|
||||
png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
|
||||
@@ -2380,4 +2389,42 @@
|
||||
@@ -2382,4 +2391,42 @@
|
||||
}
|
||||
#endif /* SIMPLIFIED_WRITE_STDIO */
|
||||
#endif /* SIMPLIFIED_WRITE */
|
||||
@ -911,7 +911,7 @@ Index: pngpread.c
|
||||
/* This routine must process all the data it has been given
|
||||
* before returning, calling the row callback as required to
|
||||
* handle the uncompressed results.
|
||||
@@ -1079,6 +1236,18 @@
|
||||
@@ -1084,6 +1241,18 @@
|
||||
png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer);
|
||||
}
|
||||
|
||||
@ -946,7 +946,7 @@ Index: pngset.c
|
||||
}
|
||||
|
||||
#ifdef PNG_oFFs_SUPPORTED
|
||||
@@ -1096,6 +1101,146 @@
|
||||
@@ -1110,6 +1115,146 @@
|
||||
}
|
||||
#endif /* sPLT */
|
||||
|
||||
@ -1097,7 +1097,7 @@ Index: pngrutil.c
|
||||
===================================================================
|
||||
--- pngrutil.c
|
||||
+++ pngrutil.c
|
||||
@@ -857,6 +857,11 @@
|
||||
@@ -860,6 +860,11 @@
|
||||
filter_type = buf[11];
|
||||
interlace_type = buf[12];
|
||||
|
||||
@ -1109,7 +1109,7 @@ Index: pngrutil.c
|
||||
/* Set internal variables */
|
||||
png_ptr->width = width;
|
||||
png_ptr->height = height;
|
||||
@@ -2757,6 +2762,180 @@
|
||||
@@ -2760,6 +2765,180 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1290,7 +1290,7 @@ Index: pngrutil.c
|
||||
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
/* Utility function for png_handle_unknown; set up png_ptr::unknown_chunk */
|
||||
static int
|
||||
@@ -4016,6 +4195,38 @@
|
||||
@@ -4022,6 +4201,38 @@
|
||||
uInt avail_in;
|
||||
png_bytep buffer;
|
||||
|
||||
@ -1329,7 +1329,7 @@ Index: pngrutil.c
|
||||
while (png_ptr->idat_size == 0)
|
||||
{
|
||||
png_crc_finish(png_ptr, 0);
|
||||
@@ -4027,6 +4238,7 @@
|
||||
@@ -4033,6 +4244,7 @@
|
||||
if (png_ptr->chunk_name != png_IDAT)
|
||||
png_error(png_ptr, "Not enough image data");
|
||||
}
|
||||
@ -1337,7 +1337,7 @@ Index: pngrutil.c
|
||||
|
||||
avail_in = png_ptr->IDAT_read_size;
|
||||
|
||||
@@ -4090,6 +4302,9 @@
|
||||
@@ -4096,6 +4308,9 @@
|
||||
|
||||
png_ptr->mode |= PNG_AFTER_IDAT;
|
||||
png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
|
||||
@ -1347,7 +1347,7 @@ Index: pngrutil.c
|
||||
|
||||
if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
|
||||
png_chunk_benign_error(png_ptr, "Extra compressed data");
|
||||
@@ -4528,4 +4743,80 @@
|
||||
@@ -4542,4 +4757,80 @@
|
||||
|
||||
png_ptr->flags |= PNG_FLAG_ROW_INIT;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.6.25 - September 1, 2016
|
||||
libpng version 1.6.26 - October 20, 2016
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||
@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.6.25 - September 1, 2016
|
||||
libpng versions 0.97, January 1998, through 1.6.26 - October 20, 2016
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||
|
||||
@ -467,8 +467,9 @@ the default, use
|
||||
|
||||
The values for png_set_crc_action() say how libpng is to handle CRC errors in
|
||||
ancillary and critical chunks, and whether to use the data contained
|
||||
therein. Note that it is impossible to "discard" data in a critical
|
||||
chunk.
|
||||
therein. Starting with libpng-1.6.26, this also governs how an ADLER32 error
|
||||
is handled while reading the IDAT chunk. Note that it is impossible to
|
||||
"discard" data in a critical chunk.
|
||||
|
||||
Choices for (int) crit_action are
|
||||
PNG_CRC_DEFAULT 0 error/quit
|
||||
@ -485,6 +486,9 @@ Choices for (int) ancil_action are
|
||||
PNG_CRC_QUIET_USE 4 quiet/use data
|
||||
PNG_CRC_NO_CHANGE 5 use the current value
|
||||
|
||||
When the setting for crit_action is PNG_CRC_QUIET_USE, the CRC and ADLER32
|
||||
checksums are not only ignored, but they are not evaluated.
|
||||
|
||||
Setting up callback code
|
||||
|
||||
You can set up a callback function to handle any unknown chunks in the
|
||||
@ -5335,8 +5339,9 @@ with an even number of lower-case hex digits, and to make them unsigned
|
||||
We prefer to use underscores rather than camelCase in names, except
|
||||
for a few type names that we inherit from zlib.h.
|
||||
|
||||
We prefer "if (something != 0)" and "if (something == 0)"
|
||||
over "if (something)" and if "(!something)", respectively.
|
||||
We prefer "if (something != 0)" and "if (something == 0)" over
|
||||
"if (something)" and if "(!something)", respectively, and for pointers
|
||||
we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)".
|
||||
|
||||
We do not use the TAB character for indentation in the C sources.
|
||||
|
||||
@ -5350,7 +5355,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.25 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.6.26 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.6.25 [September 1, 2016]
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* 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.)
|
||||
@ -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_25 Your_png_h_is_not_version_1_6_25;
|
||||
typedef png_libpng_version_1_6_26 Your_png_h_is_not_version_1_6_26;
|
||||
|
||||
/* 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
|
||||
@ -458,7 +458,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
|
||||
|
||||
#ifdef PNG_TEXT_SUPPORTED
|
||||
/* Free text item num or (if num == -1) all text items */
|
||||
if (info_ptr->text != 0 &&
|
||||
if (info_ptr->text != NULL &&
|
||||
((mask & PNG_FREE_TEXT) & info_ptr->free_me) != 0)
|
||||
{
|
||||
if (num != -1)
|
||||
@ -541,7 +541,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
|
||||
|
||||
#ifdef PNG_sPLT_SUPPORTED
|
||||
/* Free a given sPLT entry, or (if num == -1) all sPLT entries */
|
||||
if (info_ptr->splt_palettes != 0 &&
|
||||
if (info_ptr->splt_palettes != NULL &&
|
||||
((mask & PNG_FREE_SPLT) & info_ptr->free_me) != 0)
|
||||
{
|
||||
if (num != -1)
|
||||
@ -571,7 +571,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
|
||||
#endif
|
||||
|
||||
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
if (info_ptr->unknown_chunks != 0 &&
|
||||
if (info_ptr->unknown_chunks != NULL &&
|
||||
((mask & PNG_FREE_UNKN) & info_ptr->free_me) != 0)
|
||||
{
|
||||
if (num != -1)
|
||||
@ -617,7 +617,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
|
||||
/* Free any image bits attached to the info structure */
|
||||
if (((mask & PNG_FREE_ROWS) & info_ptr->free_me) != 0)
|
||||
{
|
||||
if (info_ptr->row_pointers != 0)
|
||||
if (info_ptr->row_pointers != NULL)
|
||||
{
|
||||
png_uint_32 row;
|
||||
for (row = 0; row < info_ptr->height; row++)
|
||||
@ -684,7 +684,7 @@ png_init_io(png_structrp png_ptr, png_FILE_p fp)
|
||||
void PNGAPI
|
||||
png_save_int_32(png_bytep buf, png_int_32 i)
|
||||
{
|
||||
png_save_uint_32(buf, i);
|
||||
png_save_uint_32(buf, (png_uint_32)i);
|
||||
}
|
||||
# endif
|
||||
|
||||
@ -775,7 +775,7 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.25+apng - September 1, 2016" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.26+apng - October 20, 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 \
|
||||
@ -784,7 +784,7 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||
"Portions Copyright (c) 2006-2007 Andrew Smith" PNG_STRING_NEWLINE \
|
||||
"Portions Copyright (c) 2008-2016 Max Stepin" PNG_STRING_NEWLINE ;
|
||||
# else
|
||||
return "libpng version 1.6.25+apng - September 1, 2016\
|
||||
return "libpng version 1.6.26+apng - October 20, 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.\
|
||||
@ -2533,7 +2533,7 @@ png_check_IHDR(png_const_structrp png_ptr,
|
||||
error = 1;
|
||||
}
|
||||
|
||||
if (png_gt(((width + 7) & (~7)),
|
||||
if (png_gt(((width + 7) & (~7U)),
|
||||
((PNG_SIZE_MAX
|
||||
- 48 /* big_row_buf hack */
|
||||
- 1) /* filter byte */
|
||||
@ -2944,7 +2944,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
*/
|
||||
if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */
|
||||
{
|
||||
czero = -exp_b10; /* PLUS 2 digits: TOTAL 3 */
|
||||
czero = (unsigned int)(-exp_b10); /* PLUS 2 digits: TOTAL 3 */
|
||||
exp_b10 = 0; /* Dot added below before first output. */
|
||||
}
|
||||
else
|
||||
@ -3122,11 +3122,11 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
if (exp_b10 < 0)
|
||||
{
|
||||
*ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */
|
||||
uexp_b10 = -exp_b10;
|
||||
uexp_b10 = (unsigned int)(-exp_b10);
|
||||
}
|
||||
|
||||
else
|
||||
uexp_b10 = exp_b10;
|
||||
uexp_b10 = (unsigned int)exp_b10;
|
||||
|
||||
cdigits = 0;
|
||||
|
||||
@ -3188,9 +3188,9 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
|
||||
|
||||
/* Avoid overflow here on the minimum integer. */
|
||||
if (fp < 0)
|
||||
*ascii++ = 45, num = -fp;
|
||||
*ascii++ = 45, num = (png_uint_32)(-fp);
|
||||
else
|
||||
num = fp;
|
||||
num = (png_uint_32)fp;
|
||||
|
||||
if (num <= 0x80000000) /* else overflowed */
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.25, September 1, 2016
|
||||
* libpng version 1.6.26, October 20, 2016
|
||||
*
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -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.25, September 1, 2016:
|
||||
* libpng versions 0.97, January 1998, through 1.6.26, October 20, 2016:
|
||||
* Glenn Randers-Pehrson.
|
||||
* See also "Contributing Authors", below.
|
||||
*/
|
||||
@ -41,7 +41,7 @@
|
||||
* files that are distributed with libpng have other copyright owners and
|
||||
* are released under other open source licenses.
|
||||
*
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.25, September 1, 2016 are
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.26, October 20, 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
|
||||
@ -230,7 +230,7 @@
|
||||
* ...
|
||||
* 1.5.27 15 10527 15.so.15.27[.0]
|
||||
* ...
|
||||
* 1.6.25 16 10625 16.so.16.25[.0]
|
||||
* 1.6.26 16 10626 16.so.16.26[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@ -258,13 +258,13 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* September 1, 2016
|
||||
* October 20, 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.25 are Y2K compliant. It is my belief that
|
||||
* upward through 1.6.26 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,9 +326,9 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.25+apng"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.26+apng"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.6.25+apng - September 1, 2016\n"
|
||||
" libpng version 1.6.26+apng - October 20, 2016\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
@ -336,7 +336,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 25
|
||||
#define PNG_LIBPNG_VER_RELEASE 26
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
@ -367,7 +367,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 10625 /* 1.6.25 */
|
||||
#define PNG_LIBPNG_VER 10626 /* 1.6.26 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
@ -492,7 +492,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_25;
|
||||
typedef char* png_libpng_version_1_6_26;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.25, September 1, 2016
|
||||
* libpng version 1.6.26, October 20, 2016
|
||||
*
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -507,9 +507,9 @@
|
||||
# error "libpng requires a signed 32-bit (or more) type"
|
||||
#endif
|
||||
|
||||
#if UINT_MAX > 4294967294
|
||||
#if UINT_MAX > 4294967294U
|
||||
typedef unsigned int png_uint_32;
|
||||
#elif ULONG_MAX > 4294967294
|
||||
#elif ULONG_MAX > 4294967294U
|
||||
typedef unsigned long int png_uint_32;
|
||||
#else
|
||||
# error "libpng requires an unsigned 32-bit (or more) type"
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* 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.)
|
||||
@ -573,7 +573,7 @@ png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN)
|
||||
{
|
||||
# define fixed_message "fixed point overflow in "
|
||||
# define fixed_message_ln ((sizeof fixed_message)-1)
|
||||
int iin;
|
||||
unsigned int iin;
|
||||
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
|
||||
memcpy(msg, fixed_message, fixed_message_ln);
|
||||
iin = 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* 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.)
|
||||
@ -338,7 +338,7 @@ ppi_from_ppm(png_uint_32 ppm)
|
||||
png_fixed_point result;
|
||||
if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127,
|
||||
5000) != 0)
|
||||
return result;
|
||||
return (png_uint_32)result;
|
||||
|
||||
/* Overflow. */
|
||||
return 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016%]
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2014,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.)
|
||||
@ -109,7 +109,7 @@ static png_voidp
|
||||
png_malloc_array_checked(png_const_structrp png_ptr, int nelements,
|
||||
size_t element_size)
|
||||
{
|
||||
png_alloc_size_t req = nelements; /* known to be > 0 */
|
||||
png_alloc_size_t req = (png_alloc_size_t)nelements; /* known to be > 0 */
|
||||
|
||||
if (req <= PNG_SIZE_MAX/element_size)
|
||||
return png_malloc_base(png_ptr, req * element_size);
|
||||
|
@ -841,7 +841,12 @@ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
|
||||
png_warning(png_ptr, "Truncated compressed data in IDAT");
|
||||
|
||||
else
|
||||
png_error(png_ptr, "Decompression error in IDAT");
|
||||
{
|
||||
if (ret == Z_DATA_ERROR)
|
||||
png_benign_error(png_ptr, "IDAT: ADLER32 checksum mismatch");
|
||||
else
|
||||
png_error(png_ptr, "Decompression error in IDAT");
|
||||
}
|
||||
|
||||
/* Skip the check on unprocessed input */
|
||||
return;
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* Last changed in libpng 1.6.25 [September 1, 2016]
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* 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.)
|
||||
@ -569,7 +569,8 @@
|
||||
/* This implicitly assumes alignment is always to a power of 2. */
|
||||
#ifdef png_alignof
|
||||
# define png_isaligned(ptr, type)\
|
||||
((((const char*)ptr-(const char*)0) & (png_alignof(type)-1)) == 0)
|
||||
(((type)((const char*)ptr-(const char*)0) & \
|
||||
(type)(png_alignof(type)-1)) == 0)
|
||||
#else
|
||||
# define png_isaligned(ptr, type) 0
|
||||
#endif
|
||||
@ -586,96 +587,96 @@
|
||||
* are defined in png.h because they need to be visible to applications
|
||||
* that call png_set_unknown_chunk().
|
||||
*/
|
||||
/* #define PNG_HAVE_IHDR 0x01 (defined in png.h) */
|
||||
/* #define PNG_HAVE_PLTE 0x02 (defined in png.h) */
|
||||
#define PNG_HAVE_IDAT 0x04
|
||||
/* #define PNG_AFTER_IDAT 0x08 (defined in png.h) */
|
||||
#define PNG_HAVE_IEND 0x10
|
||||
/* 0x20 (unused) */
|
||||
/* 0x40 (unused) */
|
||||
/* 0x80 (unused) */
|
||||
#define PNG_HAVE_CHUNK_HEADER 0x100
|
||||
#define PNG_WROTE_tIME 0x200
|
||||
#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
|
||||
#define PNG_BACKGROUND_IS_GRAY 0x800
|
||||
#define PNG_HAVE_PNG_SIGNATURE 0x1000
|
||||
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
|
||||
/* 0x4000 (unused) */
|
||||
#define PNG_IS_READ_STRUCT 0x8000 /* Else is a write struct */
|
||||
/* #define PNG_HAVE_IHDR 0x01U (defined in png.h) */
|
||||
/* #define PNG_HAVE_PLTE 0x02U (defined in png.h) */
|
||||
#define PNG_HAVE_IDAT 0x04U
|
||||
/* #define PNG_AFTER_IDAT 0x08U (defined in png.h) */
|
||||
#define PNG_HAVE_IEND 0x10U
|
||||
/* 0x20U (unused) */
|
||||
/* 0x40U (unused) */
|
||||
/* 0x80U (unused) */
|
||||
#define PNG_HAVE_CHUNK_HEADER 0x100U
|
||||
#define PNG_WROTE_tIME 0x200U
|
||||
#define PNG_WROTE_INFO_BEFORE_PLTE 0x400U
|
||||
#define PNG_BACKGROUND_IS_GRAY 0x800U
|
||||
#define PNG_HAVE_PNG_SIGNATURE 0x1000U
|
||||
#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
|
||||
/* 0x4000U (unused) */
|
||||
#define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */
|
||||
#ifdef PNG_APNG_SUPPORTED
|
||||
#define PNG_HAVE_acTL 0x10000
|
||||
#define PNG_HAVE_fcTL 0x20000
|
||||
#define PNG_HAVE_acTL 0x10000U
|
||||
#define PNG_HAVE_fcTL 0x20000U
|
||||
#endif
|
||||
|
||||
/* Flags for the transformations the PNG library does on the image data */
|
||||
#define PNG_BGR 0x0001
|
||||
#define PNG_INTERLACE 0x0002
|
||||
#define PNG_PACK 0x0004
|
||||
#define PNG_SHIFT 0x0008
|
||||
#define PNG_SWAP_BYTES 0x0010
|
||||
#define PNG_INVERT_MONO 0x0020
|
||||
#define PNG_QUANTIZE 0x0040
|
||||
#define PNG_COMPOSE 0x0080 /* Was PNG_BACKGROUND */
|
||||
#define PNG_BACKGROUND_EXPAND 0x0100
|
||||
#define PNG_EXPAND_16 0x0200 /* Added to libpng 1.5.2 */
|
||||
#define PNG_16_TO_8 0x0400 /* Becomes 'chop' in 1.5.4 */
|
||||
#define PNG_RGBA 0x0800
|
||||
#define PNG_EXPAND 0x1000
|
||||
#define PNG_GAMMA 0x2000
|
||||
#define PNG_GRAY_TO_RGB 0x4000
|
||||
#define PNG_FILLER 0x8000
|
||||
#define PNG_PACKSWAP 0x10000
|
||||
#define PNG_SWAP_ALPHA 0x20000
|
||||
#define PNG_STRIP_ALPHA 0x40000
|
||||
#define PNG_INVERT_ALPHA 0x80000
|
||||
#define PNG_USER_TRANSFORM 0x100000
|
||||
#define PNG_RGB_TO_GRAY_ERR 0x200000
|
||||
#define PNG_RGB_TO_GRAY_WARN 0x400000
|
||||
#define PNG_RGB_TO_GRAY 0x600000 /* two bits, RGB_TO_GRAY_ERR|WARN */
|
||||
#define PNG_ENCODE_ALPHA 0x800000 /* Added to libpng-1.5.4 */
|
||||
#define PNG_ADD_ALPHA 0x1000000 /* Added to libpng-1.2.7 */
|
||||
#define PNG_EXPAND_tRNS 0x2000000 /* Added to libpng-1.2.9 */
|
||||
#define PNG_SCALE_16_TO_8 0x4000000 /* Added to libpng-1.5.4 */
|
||||
/* 0x8000000 unused */
|
||||
/* 0x10000000 unused */
|
||||
/* 0x20000000 unused */
|
||||
/* 0x40000000 unused */
|
||||
#define PNG_BGR 0x0001U
|
||||
#define PNG_INTERLACE 0x0002U
|
||||
#define PNG_PACK 0x0004U
|
||||
#define PNG_SHIFT 0x0008U
|
||||
#define PNG_SWAP_BYTES 0x0010U
|
||||
#define PNG_INVERT_MONO 0x0020U
|
||||
#define PNG_QUANTIZE 0x0040U
|
||||
#define PNG_COMPOSE 0x0080U /* Was PNG_BACKGROUND */
|
||||
#define PNG_BACKGROUND_EXPAND 0x0100U
|
||||
#define PNG_EXPAND_16 0x0200U /* Added to libpng 1.5.2 */
|
||||
#define PNG_16_TO_8 0x0400U /* Becomes 'chop' in 1.5.4 */
|
||||
#define PNG_RGBA 0x0800U
|
||||
#define PNG_EXPAND 0x1000U
|
||||
#define PNG_GAMMA 0x2000U
|
||||
#define PNG_GRAY_TO_RGB 0x4000U
|
||||
#define PNG_FILLER 0x8000U
|
||||
#define PNG_PACKSWAP 0x10000U
|
||||
#define PNG_SWAP_ALPHA 0x20000U
|
||||
#define PNG_STRIP_ALPHA 0x40000U
|
||||
#define PNG_INVERT_ALPHA 0x80000U
|
||||
#define PNG_USER_TRANSFORM 0x100000U
|
||||
#define PNG_RGB_TO_GRAY_ERR 0x200000U
|
||||
#define PNG_RGB_TO_GRAY_WARN 0x400000U
|
||||
#define PNG_RGB_TO_GRAY 0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */
|
||||
#define PNG_ENCODE_ALPHA 0x800000U /* Added to libpng-1.5.4 */
|
||||
#define PNG_ADD_ALPHA 0x1000000U /* Added to libpng-1.2.7 */
|
||||
#define PNG_EXPAND_tRNS 0x2000000U /* Added to libpng-1.2.9 */
|
||||
#define PNG_SCALE_16_TO_8 0x4000000U /* Added to libpng-1.5.4 */
|
||||
/* 0x8000000U unused */
|
||||
/* 0x10000000U unused */
|
||||
/* 0x20000000U unused */
|
||||
/* 0x40000000U unused */
|
||||
/* Flags for png_create_struct */
|
||||
#define PNG_STRUCT_PNG 0x0001
|
||||
#define PNG_STRUCT_INFO 0x0002
|
||||
#define PNG_STRUCT_PNG 0x0001U
|
||||
#define PNG_STRUCT_INFO 0x0002U
|
||||
|
||||
/* Flags for the png_ptr->flags rather than declaring a byte for each one */
|
||||
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
|
||||
#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002 /* Added to libpng-1.6.0 */
|
||||
/* 0x0004 unused */
|
||||
#define PNG_FLAG_ZSTREAM_ENDED 0x0008 /* Added to libpng-1.6.0 */
|
||||
/* 0x0010 unused */
|
||||
/* 0x0020 unused */
|
||||
#define PNG_FLAG_ROW_INIT 0x0040
|
||||
#define PNG_FLAG_FILLER_AFTER 0x0080
|
||||
#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100
|
||||
#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
|
||||
#define PNG_FLAG_CRC_CRITICAL_USE 0x0400
|
||||
#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
|
||||
#define PNG_FLAG_ASSUME_sRGB 0x1000 /* Added to libpng-1.5.4 */
|
||||
#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000 /* Added to libpng-1.5.4 */
|
||||
#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000 /* Added to libpng-1.5.4 */
|
||||
/* #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000 */
|
||||
/* #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000 */
|
||||
#define PNG_FLAG_LIBRARY_MISMATCH 0x20000
|
||||
#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000
|
||||
#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000
|
||||
#define PNG_FLAG_BENIGN_ERRORS_WARN 0x100000 /* Added to libpng-1.4.0 */
|
||||
#define PNG_FLAG_APP_WARNINGS_WARN 0x200000 /* Added to libpng-1.6.0 */
|
||||
#define PNG_FLAG_APP_ERRORS_WARN 0x400000 /* Added to libpng-1.6.0 */
|
||||
/* 0x800000 unused */
|
||||
/* 0x1000000 unused */
|
||||
/* 0x2000000 unused */
|
||||
/* 0x4000000 unused */
|
||||
/* 0x8000000 unused */
|
||||
/* 0x10000000 unused */
|
||||
/* 0x20000000 unused */
|
||||
/* 0x40000000 unused */
|
||||
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001U
|
||||
#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002U /* Added to libpng-1.6.0 */
|
||||
/* 0x0004U unused */
|
||||
#define PNG_FLAG_ZSTREAM_ENDED 0x0008U /* Added to libpng-1.6.0 */
|
||||
/* 0x0010U unused */
|
||||
/* 0x0020U unused */
|
||||
#define PNG_FLAG_ROW_INIT 0x0040U
|
||||
#define PNG_FLAG_FILLER_AFTER 0x0080U
|
||||
#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100U
|
||||
#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200U
|
||||
#define PNG_FLAG_CRC_CRITICAL_USE 0x0400U
|
||||
#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800U
|
||||
#define PNG_FLAG_ASSUME_sRGB 0x1000U /* Added to libpng-1.5.4 */
|
||||
#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000U /* Added to libpng-1.5.4 */
|
||||
#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000U /* Added to libpng-1.5.4 */
|
||||
/* #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000U */
|
||||
/* #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000U */
|
||||
#define PNG_FLAG_LIBRARY_MISMATCH 0x20000U
|
||||
#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000U
|
||||
#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000U
|
||||
#define PNG_FLAG_BENIGN_ERRORS_WARN 0x100000U /* Added to libpng-1.4.0 */
|
||||
#define PNG_FLAG_APP_WARNINGS_WARN 0x200000U /* Added to libpng-1.6.0 */
|
||||
#define PNG_FLAG_APP_ERRORS_WARN 0x400000U /* Added to libpng-1.6.0 */
|
||||
/* 0x800000U unused */
|
||||
/* 0x1000000U unused */
|
||||
/* 0x2000000U unused */
|
||||
/* 0x4000000U unused */
|
||||
/* 0x8000000U unused */
|
||||
/* 0x10000000U unused */
|
||||
/* 0x20000000U unused */
|
||||
/* 0x40000000U unused */
|
||||
|
||||
#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
|
||||
PNG_FLAG_CRC_ANCILLARY_NOWARN)
|
||||
@ -709,6 +710,24 @@
|
||||
((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \
|
||||
(( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) )
|
||||
|
||||
/* This returns the number of trailing bits in the last byte of a row, 0 if the
|
||||
* last byte is completely full of pixels. It is, in principle, (pixel_bits x
|
||||
* width) % 8, but that would overflow for large 'width'. The second macro is
|
||||
* the same except that it returns the number of unused bits in the last byte;
|
||||
* (8-TRAILBITS), but 0 when TRAILBITS is 0.
|
||||
*
|
||||
* NOTE: these macros are intended to be self-evidently correct and never
|
||||
* overflow on the assumption that pixel_bits is in the range 0..255. The
|
||||
* arguments are evaluated only once and they can be signed (e.g. as a result of
|
||||
* the integral promotions). The result of the expression always has type
|
||||
* (png_uint_32), however the compiler always knows it is in the range 0..7.
|
||||
*/
|
||||
#define PNG_TRAILBITS(pixel_bits, width) \
|
||||
(((pixel_bits) * ((width) % (png_uint_32)8)) % 8)
|
||||
|
||||
#define PNG_PADBITS(pixel_bits, width) \
|
||||
((8 - PNG_TRAILBITS(pixel_bits, width)) % 8)
|
||||
|
||||
/* PNG_OUT_OF_RANGE returns true if value is outside the range
|
||||
* ideal-delta..ideal+delta. Each argument is evaluated twice.
|
||||
* "ideal" and "delta" should be constants, normally simple
|
||||
@ -829,8 +848,8 @@
|
||||
#define png_fdAT PNG_U32(102, 100, 65, 84)
|
||||
|
||||
/* For png_struct.apng_flags: */
|
||||
#define PNG_FIRST_FRAME_HIDDEN 0x0001
|
||||
#define PNG_APNG_APP 0x0002
|
||||
#define PNG_FIRST_FRAME_HIDDEN 0x0001U
|
||||
#define PNG_APNG_APP 0x0002U
|
||||
#endif
|
||||
|
||||
/* The following will work on (signed char*) strings, whereas the get_uint_32
|
||||
@ -1328,7 +1347,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
|
||||
/* Initialize the row buffers, etc. */
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
|
||||
|
||||
#if PNG_ZLIB_VERNUM >= 0x1240
|
||||
#if ZLIB_VERNUM >= 0x1240
|
||||
PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush),
|
||||
PNG_EMPTY);
|
||||
# define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* 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.)
|
||||
@ -439,9 +439,9 @@ png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||
{
|
||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
|
||||
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
|
||||
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
||||
png_uint_32 s0 = (png_uint_32)(*(rp ) << 8) | *(rp + 1);
|
||||
png_uint_32 s1 = (png_uint_32)(*(rp + 2) << 8) | *(rp + 3);
|
||||
png_uint_32 s2 = (png_uint_32)(*(rp + 4) << 8) | *(rp + 5);
|
||||
png_uint_32 red = (s0 + s1 + 65536) & 0xffff;
|
||||
png_uint_32 blue = (s2 + s1 + 65536) & 0xffff;
|
||||
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
||||
@ -1473,7 +1473,9 @@ png_image_read_header(png_voidp argument)
|
||||
png_structrp png_ptr = image->opaque->png_ptr;
|
||||
png_inforp info_ptr = image->opaque->info_ptr;
|
||||
|
||||
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||
png_set_benign_errors(png_ptr, 1/*warn*/);
|
||||
#endif
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
/* Do this the fast way; just read directly out of png_struct. */
|
||||
@ -1511,7 +1513,7 @@ png_image_read_header(png_voidp argument)
|
||||
break;
|
||||
|
||||
case PNG_COLOR_TYPE_PALETTE:
|
||||
cmap_entries = png_ptr->num_palette;
|
||||
cmap_entries = (png_uint_32)png_ptr->num_palette;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -2046,7 +2048,7 @@ make_gray_file_colormap(png_image_read_control *display)
|
||||
for (i=0; i<256; ++i)
|
||||
png_create_colormap_entry(display, i, i, i, i, 255, P_FILE);
|
||||
|
||||
return i;
|
||||
return (int)i;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -2057,7 +2059,7 @@ make_gray_colormap(png_image_read_control *display)
|
||||
for (i=0; i<256; ++i)
|
||||
png_create_colormap_entry(display, i, i, i, i, 255, P_sRGB);
|
||||
|
||||
return i;
|
||||
return (int)i;
|
||||
}
|
||||
#define PNG_GRAY_COLORMAP_ENTRIES 256
|
||||
|
||||
@ -2111,7 +2113,7 @@ make_ga_colormap(png_image_read_control *display)
|
||||
P_sRGB);
|
||||
}
|
||||
|
||||
return i;
|
||||
return (int)i;
|
||||
}
|
||||
|
||||
#define PNG_GA_COLORMAP_ENTRIES 256
|
||||
@ -2136,7 +2138,7 @@ make_rgb_colormap(png_image_read_control *display)
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
return (int)i;
|
||||
}
|
||||
|
||||
#define PNG_RGB_COLORMAP_ENTRIES 216
|
||||
@ -2329,7 +2331,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries)
|
||||
png_error(png_ptr, "gray[16] color-map: too few entries");
|
||||
|
||||
cmap_entries = make_gray_colormap(display);
|
||||
cmap_entries = (unsigned int)make_gray_colormap(display);
|
||||
|
||||
if (png_ptr->num_trans > 0)
|
||||
{
|
||||
@ -2427,7 +2429,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries)
|
||||
png_error(png_ptr, "gray+alpha color-map: too few entries");
|
||||
|
||||
cmap_entries = make_ga_colormap(display);
|
||||
cmap_entries = (unsigned int)make_ga_colormap(display);
|
||||
|
||||
background_index = PNG_CMAP_GA_BACKGROUND;
|
||||
output_processing = PNG_CMAP_GA;
|
||||
@ -2461,7 +2463,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries)
|
||||
png_error(png_ptr, "gray-alpha color-map: too few entries");
|
||||
|
||||
cmap_entries = make_gray_colormap(display);
|
||||
cmap_entries = (unsigned int)make_gray_colormap(display);
|
||||
|
||||
if (output_encoding == P_LINEAR)
|
||||
{
|
||||
@ -2600,7 +2602,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries)
|
||||
png_error(png_ptr, "rgb[ga] color-map: too few entries");
|
||||
|
||||
cmap_entries = make_ga_colormap(display);
|
||||
cmap_entries = (unsigned int)make_ga_colormap(display);
|
||||
background_index = PNG_CMAP_GA_BACKGROUND;
|
||||
output_processing = PNG_CMAP_GA;
|
||||
}
|
||||
@ -2626,12 +2628,12 @@ png_image_read_colormap(png_voidp argument)
|
||||
png_ptr->num_trans > 0) &&
|
||||
png_gamma_not_sRGB(png_ptr->colorspace.gamma) != 0)
|
||||
{
|
||||
cmap_entries = make_gray_file_colormap(display);
|
||||
cmap_entries = (unsigned int)make_gray_file_colormap(display);
|
||||
data_encoding = P_FILE;
|
||||
}
|
||||
|
||||
else
|
||||
cmap_entries = make_gray_colormap(display);
|
||||
cmap_entries = (unsigned int)make_gray_colormap(display);
|
||||
|
||||
/* But if the input has alpha or transparency it must be removed
|
||||
*/
|
||||
@ -2719,7 +2721,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
if (PNG_RGB_COLORMAP_ENTRIES+1+27 > image->colormap_entries)
|
||||
png_error(png_ptr, "rgb+alpha color-map: too few entries");
|
||||
|
||||
cmap_entries = make_rgb_colormap(display);
|
||||
cmap_entries = (unsigned int)make_rgb_colormap(display);
|
||||
|
||||
/* Add a transparent entry. */
|
||||
png_create_colormap_entry(display, cmap_entries, 255, 255,
|
||||
@ -2768,7 +2770,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
if (PNG_RGB_COLORMAP_ENTRIES+1+27 > image->colormap_entries)
|
||||
png_error(png_ptr, "rgb-alpha color-map: too few entries");
|
||||
|
||||
cmap_entries = make_rgb_colormap(display);
|
||||
cmap_entries = (unsigned int)make_rgb_colormap(display);
|
||||
|
||||
png_create_colormap_entry(display, cmap_entries, back_r,
|
||||
back_g, back_b, 0/*unused*/, output_encoding);
|
||||
@ -2853,7 +2855,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
if (PNG_RGB_COLORMAP_ENTRIES > image->colormap_entries)
|
||||
png_error(png_ptr, "rgb color-map: too few entries");
|
||||
|
||||
cmap_entries = make_rgb_colormap(display);
|
||||
cmap_entries = (unsigned int)make_rgb_colormap(display);
|
||||
output_processing = PNG_CMAP_RGB;
|
||||
}
|
||||
}
|
||||
@ -2877,11 +2879,11 @@ png_image_read_colormap(png_voidp argument)
|
||||
|
||||
output_processing = PNG_CMAP_NONE;
|
||||
data_encoding = P_FILE; /* Don't change from color-map indices */
|
||||
cmap_entries = png_ptr->num_palette;
|
||||
cmap_entries = (unsigned int)png_ptr->num_palette;
|
||||
if (cmap_entries > 256)
|
||||
cmap_entries = 256;
|
||||
|
||||
if (cmap_entries > image->colormap_entries)
|
||||
if (cmap_entries > (unsigned int)image->colormap_entries)
|
||||
png_error(png_ptr, "palette color-map: too few entries");
|
||||
|
||||
for (i=0; i < cmap_entries; ++i)
|
||||
@ -2993,7 +2995,7 @@ png_image_read_colormap(png_voidp argument)
|
||||
png_error(png_ptr, "bad background index (internal error)");
|
||||
}
|
||||
|
||||
display->colormap_processing = output_processing;
|
||||
display->colormap_processing = (int)output_processing;
|
||||
|
||||
return 1/*ok*/;
|
||||
}
|
||||
@ -3302,14 +3304,14 @@ png_image_read_colormapped(png_voidp argument)
|
||||
|
||||
else
|
||||
{
|
||||
png_alloc_size_t row_bytes = display->row_bytes;
|
||||
png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes;
|
||||
|
||||
while (--passes >= 0)
|
||||
{
|
||||
png_uint_32 y = image->height;
|
||||
png_bytep row = png_voidcast(png_bytep, display->first_row);
|
||||
|
||||
while (y-- > 0)
|
||||
for (; y > 0; --y)
|
||||
{
|
||||
png_read_row(png_ptr, row, NULL);
|
||||
row += row_bytes;
|
||||
@ -3637,8 +3639,9 @@ png_image_read_background(png_voidp argument)
|
||||
* stride which was multiplied by 2 (below) to get row_bytes.
|
||||
*/
|
||||
ptrdiff_t step_row = display->row_bytes / 2;
|
||||
int preserve_alpha = (image->format & PNG_FORMAT_FLAG_ALPHA) != 0;
|
||||
unsigned int outchannels = 1+preserve_alpha;
|
||||
unsigned int preserve_alpha = (image->format &
|
||||
PNG_FORMAT_FLAG_ALPHA) != 0;
|
||||
unsigned int outchannels = 1U+preserve_alpha;
|
||||
int swap_alpha = 0;
|
||||
|
||||
# ifdef PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
|
||||
@ -4135,14 +4138,14 @@ png_image_read_direct(png_voidp argument)
|
||||
|
||||
else
|
||||
{
|
||||
png_alloc_size_t row_bytes = display->row_bytes;
|
||||
png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes;
|
||||
|
||||
while (--passes >= 0)
|
||||
{
|
||||
png_uint_32 y = image->height;
|
||||
png_bytep row = png_voidcast(png_bytep, display->first_row);
|
||||
|
||||
while (y-- > 0)
|
||||
for (; y > 0; --y)
|
||||
{
|
||||
png_read_row(png_ptr, row, NULL);
|
||||
row += row_bytes;
|
||||
@ -4171,7 +4174,7 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
|
||||
* bits; this is just to verify that the 'row_stride' argument can be
|
||||
* represented.
|
||||
*/
|
||||
if (image->width <= 0x7FFFFFFFU/channels) /* no overflow */
|
||||
if (image->width <= 0x7fffffffU/channels) /* no overflow */
|
||||
{
|
||||
png_uint_32 check;
|
||||
const png_uint_32 png_row_stride = image->width * channels;
|
||||
@ -4180,10 +4183,10 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
|
||||
row_stride = (png_int_32)/*SAFE*/png_row_stride;
|
||||
|
||||
if (row_stride < 0)
|
||||
check = -row_stride;
|
||||
check = (png_uint_32)(-row_stride);
|
||||
|
||||
else
|
||||
check = row_stride;
|
||||
check = (png_uint_32)row_stride;
|
||||
|
||||
/* This verifies 'check', the absolute value of the actual stride
|
||||
* passed in and detects overflow in the application calculation (i.e.
|
||||
@ -4208,7 +4211,7 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
|
||||
* accomodated on 64-bit systems.
|
||||
*/
|
||||
if (image->height <=
|
||||
0xFFFFFFFFU/PNG_IMAGE_PIXEL_COMPONENT_SIZE(image->format)/check)
|
||||
0xffffffffU/PNG_IMAGE_PIXEL_COMPONENT_SIZE(image->format)/check)
|
||||
{
|
||||
if ((image->format & PNG_FORMAT_FLAG_COLORMAP) == 0 ||
|
||||
(image->colormap_entries > 0 && colormap != NULL))
|
||||
|
@ -429,7 +429,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||
int i;
|
||||
|
||||
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)(num_palette * (sizeof (png_byte))));
|
||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
for (i = 0; i < num_palette; i++)
|
||||
png_ptr->quantize_index[i] = (png_byte)i;
|
||||
}
|
||||
@ -446,7 +446,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||
|
||||
/* Initialize an array to sort colors */
|
||||
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)(num_palette * (sizeof (png_byte))));
|
||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
|
||||
/* Initialize the quantize_sort array */
|
||||
for (i = 0; i < num_palette; i++)
|
||||
@ -580,9 +580,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||
|
||||
/* Initialize palette index arrays */
|
||||
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)(num_palette * (sizeof (png_byte))));
|
||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)(num_palette * (sizeof (png_byte))));
|
||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
|
||||
/* Initialize the sort array */
|
||||
for (i = 0; i < num_palette; i++)
|
||||
@ -2150,7 +2150,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_bytep sp = row + (png_size_t)((row_width - 1) >> 3);
|
||||
png_bytep dp = row + (png_size_t)row_width - 1;
|
||||
png_uint_32 shift = 7 - (int)((row_width + 7) & 0x07);
|
||||
png_uint_32 shift = 7U - ((row_width + 7U) & 0x07);
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*dp = (png_byte)((*sp >> shift) & 0x01);
|
||||
@ -2174,7 +2174,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
|
||||
|
||||
png_bytep sp = row + (png_size_t)((row_width - 1) >> 2);
|
||||
png_bytep dp = row + (png_size_t)row_width - 1;
|
||||
png_uint_32 shift = (int)((3 - ((row_width + 3) & 0x03)) << 1);
|
||||
png_uint_32 shift = ((3U - ((row_width + 3U) & 0x03)) << 1);
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*dp = (png_byte)((*sp >> shift) & 0x03);
|
||||
@ -2197,7 +2197,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_bytep sp = row + (png_size_t)((row_width - 1) >> 1);
|
||||
png_bytep dp = row + (png_size_t)row_width - 1;
|
||||
png_uint_32 shift = (int)((1 - ((row_width + 1) & 0x01)) << 2);
|
||||
png_uint_32 shift = ((1U - ((row_width + 1U) & 0x01)) << 2);
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*dp = (png_byte)((*sp >> shift) & 0x0f);
|
||||
@ -3223,7 +3223,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
== png_ptr->trans_color.gray)
|
||||
{
|
||||
unsigned int tmp = *sp & (0x7f7f >> (7 - shift));
|
||||
tmp |= png_ptr->background.gray << shift;
|
||||
tmp |=
|
||||
(unsigned int)(png_ptr->background.gray << shift);
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
|
||||
@ -3252,7 +3253,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
== png_ptr->trans_color.gray)
|
||||
{
|
||||
unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
|
||||
tmp |= png_ptr->background.gray << shift;
|
||||
tmp |=
|
||||
(unsigned int)png_ptr->background.gray << shift;
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
|
||||
@ -3262,7 +3264,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
unsigned int g = (gamma_table [p | (p << 2) |
|
||||
(p << 4) | (p << 6)] >> 6) & 0x03;
|
||||
unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
|
||||
tmp |= g << shift;
|
||||
tmp |= (unsigned int)(g << shift);
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
|
||||
@ -3288,7 +3290,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
== png_ptr->trans_color.gray)
|
||||
{
|
||||
unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
|
||||
tmp |= png_ptr->background.gray << shift;
|
||||
tmp |=
|
||||
(unsigned int)png_ptr->background.gray << shift;
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
|
||||
@ -3318,7 +3321,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
== png_ptr->trans_color.gray)
|
||||
{
|
||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||
tmp |= png_ptr->background.gray << shift;
|
||||
tmp |=
|
||||
(unsigned int)(png_ptr->background.gray << shift);
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
|
||||
@ -3328,7 +3332,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
unsigned int g = (gamma_table[p | (p << 4)] >> 4) &
|
||||
0x0f;
|
||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||
tmp |= g << shift;
|
||||
tmp |= (unsigned int)(g << shift);
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
|
||||
@ -3354,7 +3358,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
== png_ptr->trans_color.gray)
|
||||
{
|
||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||
tmp |= png_ptr->background.gray << shift;
|
||||
tmp |=
|
||||
(unsigned int)(png_ptr->background.gray << shift);
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.25 [September 1, 2016]
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* 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.)
|
||||
@ -86,7 +86,7 @@ png_get_int_32)(png_const_bytep buf)
|
||||
{
|
||||
png_uint_32 uval = png_get_uint_32(buf);
|
||||
if ((uval & 0x80000000) == 0) /* non-negative */
|
||||
return uval;
|
||||
return (png_int_32)uval;
|
||||
|
||||
uval = (uval ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */
|
||||
if ((uval & 0x80000000) == 0) /* no overflow */
|
||||
@ -370,11 +370,10 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
||||
*/
|
||||
{
|
||||
int ret; /* zlib return code */
|
||||
#if PNG_ZLIB_VERNUM >= 0x1240
|
||||
#if ZLIB_VERNUM >= 0x1240
|
||||
int window_bits = 0;
|
||||
|
||||
# if defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_MAXIMUM_INFLATE_WINDOW)
|
||||
int window_bits;
|
||||
|
||||
if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) ==
|
||||
PNG_OPTION_ON)
|
||||
{
|
||||
@ -384,13 +383,11 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
||||
|
||||
else
|
||||
{
|
||||
window_bits = 0;
|
||||
png_ptr->zstream_start = 1;
|
||||
}
|
||||
# else
|
||||
# define window_bits 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* ZLIB_VERNUM >= 0x1240 */
|
||||
|
||||
/* Set this for safety, just in case the previous owner left pointers to
|
||||
* memory allocations.
|
||||
@ -402,25 +399,31 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
||||
|
||||
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
|
||||
{
|
||||
#if PNG_ZLIB_VERNUM < 0x1240
|
||||
ret = inflateReset(&png_ptr->zstream);
|
||||
#else
|
||||
#if ZLIB_VERNUM >= 0x1240
|
||||
ret = inflateReset2(&png_ptr->zstream, window_bits);
|
||||
#else
|
||||
ret = inflateReset(&png_ptr->zstream);
|
||||
#endif
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
#if PNG_ZLIB_VERNUM < 0x1240
|
||||
ret = inflateInit(&png_ptr->zstream);
|
||||
#else
|
||||
#if ZLIB_VERNUM >= 0x1240
|
||||
ret = inflateInit2(&png_ptr->zstream, window_bits);
|
||||
#else
|
||||
ret = inflateInit(&png_ptr->zstream);
|
||||
#endif
|
||||
|
||||
if (ret == Z_OK)
|
||||
png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
|
||||
}
|
||||
|
||||
#if ZLIB_VERNUM >= 0x1281
|
||||
/* Turn off validation of the ADLER32 checksum */
|
||||
if ((png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) != 0)
|
||||
ret = inflateValidate(&png_ptr->zstream, 0);
|
||||
#endif
|
||||
|
||||
if (ret == Z_OK)
|
||||
png_ptr->zowner = owner;
|
||||
|
||||
@ -435,7 +438,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if PNG_ZLIB_VERNUM >= 0x1240
|
||||
#if ZLIB_VERNUM >= 0x1240
|
||||
/* Handle the start of the inflate stream if we called inflateInit2(strm,0);
|
||||
* in this case some zlib versions skip validation of the CINFO field and, in
|
||||
* certain circumstances, libpng may end up displaying an invalid image, in
|
||||
@ -1016,7 +1019,7 @@ png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
#endif
|
||||
{
|
||||
png_crc_finish(png_ptr, (int) length - num * 3);
|
||||
png_crc_finish(png_ptr, (png_uint_32) (length - (unsigned int)num * 3));
|
||||
}
|
||||
|
||||
#ifndef PNG_READ_OPT_PLTE_SUPPORTED
|
||||
@ -1722,13 +1725,13 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
data_length = length - (png_uint_32)(entry_start - buffer);
|
||||
|
||||
/* Integrity-check the data length */
|
||||
if ((data_length % entry_size) != 0)
|
||||
if ((data_length % (unsigned int)entry_size) != 0)
|
||||
{
|
||||
png_warning(png_ptr, "sPLT chunk has bad length");
|
||||
return;
|
||||
}
|
||||
|
||||
dl = (png_int_32)(data_length / entry_size);
|
||||
dl = (png_uint_32)(data_length / (unsigned int)entry_size);
|
||||
max_dl = PNG_SIZE_MAX / (sizeof (png_sPLT_entry));
|
||||
|
||||
if (dl > max_dl)
|
||||
@ -1737,10 +1740,10 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
return;
|
||||
}
|
||||
|
||||
new_palette.nentries = (png_int_32)(data_length / entry_size);
|
||||
new_palette.nentries = (png_int_32)(data_length / (unsigned int)entry_size);
|
||||
|
||||
new_palette.entries = (png_sPLT_entryp)png_malloc_warn(
|
||||
png_ptr, new_palette.nentries * (sizeof (png_sPLT_entry)));
|
||||
new_palette.entries = (png_sPLT_entryp)png_malloc_warn(png_ptr,
|
||||
(png_alloc_size_t) new_palette.nentries * (sizeof (png_sPLT_entry)));
|
||||
|
||||
if (new_palette.entries == NULL)
|
||||
{
|
||||
@ -3278,7 +3281,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
||||
# ifdef PNG_READ_PACKSWAP_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
|
||||
/* little-endian byte */
|
||||
end_mask = 0xff << end_mask;
|
||||
end_mask = (unsigned int)(0xff << end_mask);
|
||||
|
||||
else /* big-endian byte */
|
||||
# endif
|
||||
@ -3724,7 +3727,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
{
|
||||
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||
/* Offset to next interlace block */
|
||||
static PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
static PNG_CONST unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
|
||||
|
||||
png_debug(1, "in png_do_read_interlace");
|
||||
if (row != NULL && row_info != NULL)
|
||||
@ -3739,9 +3742,10 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
{
|
||||
png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 3);
|
||||
png_bytep dp = row + (png_size_t)((final_width - 1) >> 3);
|
||||
int sshift, dshift;
|
||||
int s_start, s_end, s_inc;
|
||||
int jstop = png_pass_inc[pass];
|
||||
unsigned int sshift, dshift;
|
||||
unsigned int s_start, s_end;
|
||||
int s_inc;
|
||||
int jstop = (int)png_pass_inc[pass];
|
||||
png_byte v;
|
||||
png_uint_32 i;
|
||||
int j;
|
||||
@ -3749,8 +3753,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
#ifdef PNG_READ_PACKSWAP_SUPPORTED
|
||||
if ((transformations & PNG_PACKSWAP) != 0)
|
||||
{
|
||||
sshift = (int)((row_info->width + 7) & 0x07);
|
||||
dshift = (int)((final_width + 7) & 0x07);
|
||||
sshift = ((row_info->width + 7) & 0x07);
|
||||
dshift = ((final_width + 7) & 0x07);
|
||||
s_start = 7;
|
||||
s_end = 0;
|
||||
s_inc = -1;
|
||||
@ -3759,8 +3763,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
else
|
||||
#endif
|
||||
{
|
||||
sshift = 7 - (int)((row_info->width + 7) & 0x07);
|
||||
dshift = 7 - (int)((final_width + 7) & 0x07);
|
||||
sshift = 7 - ((row_info->width + 7) & 0x07);
|
||||
dshift = 7 - ((final_width + 7) & 0x07);
|
||||
s_start = 0;
|
||||
s_end = 7;
|
||||
s_inc = 1;
|
||||
@ -3772,7 +3776,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
for (j = 0; j < jstop; j++)
|
||||
{
|
||||
unsigned int tmp = *dp & (0x7f7f >> (7 - dshift));
|
||||
tmp |= v << dshift;
|
||||
tmp |= (unsigned int)(v << dshift);
|
||||
*dp = (png_byte)(tmp & 0xff);
|
||||
|
||||
if (dshift == s_end)
|
||||
@ -3782,7 +3786,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
}
|
||||
|
||||
else
|
||||
dshift += s_inc;
|
||||
dshift = (unsigned int)((int)dshift + s_inc);
|
||||
}
|
||||
|
||||
if (sshift == s_end)
|
||||
@ -3792,7 +3796,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
}
|
||||
|
||||
else
|
||||
sshift += s_inc;
|
||||
sshift = (unsigned int)((int)sshift + s_inc);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -3801,16 +3805,17 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
{
|
||||
png_bytep sp = row + (png_uint_32)((row_info->width - 1) >> 2);
|
||||
png_bytep dp = row + (png_uint_32)((final_width - 1) >> 2);
|
||||
int sshift, dshift;
|
||||
int s_start, s_end, s_inc;
|
||||
int jstop = png_pass_inc[pass];
|
||||
unsigned int sshift, dshift;
|
||||
unsigned int s_start, s_end;
|
||||
int s_inc;
|
||||
int jstop = (int)png_pass_inc[pass];
|
||||
png_uint_32 i;
|
||||
|
||||
#ifdef PNG_READ_PACKSWAP_SUPPORTED
|
||||
if ((transformations & PNG_PACKSWAP) != 0)
|
||||
{
|
||||
sshift = (int)(((row_info->width + 3) & 0x03) << 1);
|
||||
dshift = (int)(((final_width + 3) & 0x03) << 1);
|
||||
sshift = (((row_info->width + 3) & 0x03) << 1);
|
||||
dshift = (((final_width + 3) & 0x03) << 1);
|
||||
s_start = 6;
|
||||
s_end = 0;
|
||||
s_inc = -2;
|
||||
@ -3819,8 +3824,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
else
|
||||
#endif
|
||||
{
|
||||
sshift = (int)((3 - ((row_info->width + 3) & 0x03)) << 1);
|
||||
dshift = (int)((3 - ((final_width + 3) & 0x03)) << 1);
|
||||
sshift = ((3 - ((row_info->width + 3) & 0x03)) << 1);
|
||||
dshift = ((3 - ((final_width + 3) & 0x03)) << 1);
|
||||
s_start = 0;
|
||||
s_end = 6;
|
||||
s_inc = 2;
|
||||
@ -3835,7 +3840,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
for (j = 0; j < jstop; j++)
|
||||
{
|
||||
unsigned int tmp = *dp & (0x3f3f >> (6 - dshift));
|
||||
tmp |= v << dshift;
|
||||
tmp |= (unsigned int)(v << dshift);
|
||||
*dp = (png_byte)(tmp & 0xff);
|
||||
|
||||
if (dshift == s_end)
|
||||
@ -3845,7 +3850,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
}
|
||||
|
||||
else
|
||||
dshift += s_inc;
|
||||
dshift = (unsigned int)((int)dshift + s_inc);
|
||||
}
|
||||
|
||||
if (sshift == s_end)
|
||||
@ -3855,7 +3860,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
}
|
||||
|
||||
else
|
||||
sshift += s_inc;
|
||||
sshift = (unsigned int)((int)sshift + s_inc);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -3864,16 +3869,17 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
{
|
||||
png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 1);
|
||||
png_bytep dp = row + (png_size_t)((final_width - 1) >> 1);
|
||||
int sshift, dshift;
|
||||
int s_start, s_end, s_inc;
|
||||
unsigned int sshift, dshift;
|
||||
unsigned int s_start, s_end;
|
||||
int s_inc;
|
||||
png_uint_32 i;
|
||||
int jstop = png_pass_inc[pass];
|
||||
int jstop = (int)png_pass_inc[pass];
|
||||
|
||||
#ifdef PNG_READ_PACKSWAP_SUPPORTED
|
||||
if ((transformations & PNG_PACKSWAP) != 0)
|
||||
{
|
||||
sshift = (int)(((row_info->width + 1) & 0x01) << 2);
|
||||
dshift = (int)(((final_width + 1) & 0x01) << 2);
|
||||
sshift = (((row_info->width + 1) & 0x01) << 2);
|
||||
dshift = (((final_width + 1) & 0x01) << 2);
|
||||
s_start = 4;
|
||||
s_end = 0;
|
||||
s_inc = -4;
|
||||
@ -3882,8 +3888,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
else
|
||||
#endif
|
||||
{
|
||||
sshift = (int)((1 - ((row_info->width + 1) & 0x01)) << 2);
|
||||
dshift = (int)((1 - ((final_width + 1) & 0x01)) << 2);
|
||||
sshift = ((1 - ((row_info->width + 1) & 0x01)) << 2);
|
||||
dshift = ((1 - ((final_width + 1) & 0x01)) << 2);
|
||||
s_start = 0;
|
||||
s_end = 4;
|
||||
s_inc = 4;
|
||||
@ -3897,7 +3903,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
for (j = 0; j < jstop; j++)
|
||||
{
|
||||
unsigned int tmp = *dp & (0xf0f >> (4 - dshift));
|
||||
tmp |= v << dshift;
|
||||
tmp |= (unsigned int)(v << dshift);
|
||||
*dp = (png_byte)(tmp & 0xff);
|
||||
|
||||
if (dshift == s_end)
|
||||
@ -3907,7 +3913,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
}
|
||||
|
||||
else
|
||||
dshift += s_inc;
|
||||
dshift = (unsigned int)((int)dshift + s_inc);
|
||||
}
|
||||
|
||||
if (sshift == s_end)
|
||||
@ -3917,7 +3923,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
}
|
||||
|
||||
else
|
||||
sshift += s_inc;
|
||||
sshift = (unsigned int)((int)sshift + s_inc);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -3931,7 +3937,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
|
||||
png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes;
|
||||
|
||||
int jstop = png_pass_inc[pass];
|
||||
int jstop = (int)png_pass_inc[pass];
|
||||
png_uint_32 i;
|
||||
|
||||
for (i = 0; i < row_info->width; i++)
|
||||
@ -4075,7 +4081,7 @@ static void
|
||||
png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
int bpp = (row_info->pixel_depth + 7) >> 3;
|
||||
unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
|
||||
png_bytep rp_end = row + bpp;
|
||||
|
||||
/* Process the first pixel in the row completely (this is the same as 'up'
|
||||
@ -4088,7 +4094,7 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
|
||||
}
|
||||
|
||||
/* Remainder */
|
||||
rp_end += row_info->rowbytes - bpp;
|
||||
rp_end = rp_end + (row_info->rowbytes - bpp);
|
||||
|
||||
while (row < rp_end)
|
||||
{
|
||||
@ -4316,7 +4322,15 @@ png_read_IDAT_data(png_structrp png_ptr, png_bytep output,
|
||||
png_zstream_error(png_ptr, ret);
|
||||
|
||||
if (output != NULL)
|
||||
png_chunk_error(png_ptr, png_ptr->zstream.msg);
|
||||
{
|
||||
if(!strncmp(png_ptr->zstream.msg,"incorrect data check",20))
|
||||
{
|
||||
png_chunk_benign_error(png_ptr, "ADLER32 checksum mismatch");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
png_chunk_error(png_ptr, png_ptr->zstream.msg);
|
||||
}
|
||||
|
||||
else /* checking */
|
||||
{
|
||||
@ -4469,7 +4483,7 @@ png_read_start_row(png_structrp png_ptr)
|
||||
/* Offset to next interlace block in the y direction */
|
||||
static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
int max_pixel_depth;
|
||||
unsigned int max_pixel_depth;
|
||||
png_size_t row_bytes;
|
||||
|
||||
png_debug(1, "in png_read_start_row");
|
||||
@ -4498,7 +4512,7 @@ png_read_start_row(png_structrp png_ptr)
|
||||
png_ptr->iwidth = png_ptr->width;
|
||||
}
|
||||
|
||||
max_pixel_depth = png_ptr->pixel_depth;
|
||||
max_pixel_depth = (unsigned int)png_ptr->pixel_depth;
|
||||
|
||||
/* WARNING: * png_read_transform_info (pngrtran.c) performs a simpler set of
|
||||
* calculations to calculate the final pixel depth, then
|
||||
@ -4633,7 +4647,7 @@ png_read_start_row(png_structrp png_ptr)
|
||||
defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
|
||||
{
|
||||
int user_pixel_depth = png_ptr->user_transform_depth *
|
||||
unsigned int user_pixel_depth = png_ptr->user_transform_depth *
|
||||
png_ptr->user_transform_channels;
|
||||
|
||||
if (user_pixel_depth > max_pixel_depth)
|
||||
@ -4655,7 +4669,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
* for safety's sake
|
||||
*/
|
||||
row_bytes = PNG_ROWBYTES(max_pixel_depth, row_bytes) +
|
||||
1 + ((max_pixel_depth + 7) >> 3);
|
||||
1 + ((max_pixel_depth + 7) >> 3U);
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
if (row_bytes > (png_uint_32)65536L)
|
||||
@ -4724,7 +4738,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
* does not, so free the read buffer now regardless; the sequential reader
|
||||
* reallocates it on demand.
|
||||
*/
|
||||
if (png_ptr->read_buffer != 0)
|
||||
if (png_ptr->read_buffer != NULL)
|
||||
{
|
||||
png_bytep buffer = png_ptr->read_buffer;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Copyright (c) 1998-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.)
|
||||
@ -288,17 +288,29 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
|
||||
/* Check that the type matches the specification. */
|
||||
if (type < 0 || type > 3)
|
||||
png_error(png_ptr, "Invalid pCAL equation type");
|
||||
{
|
||||
png_chunk_report(png_ptr, "Invalid pCAL equation type",
|
||||
PNG_CHUNK_WRITE_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nparams < 0 || nparams > 255)
|
||||
png_error(png_ptr, "Invalid pCAL parameter count");
|
||||
{
|
||||
png_chunk_report(png_ptr, "Invalid pCAL parameter count",
|
||||
PNG_CHUNK_WRITE_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Validate params[nparams] */
|
||||
for (i=0; i<nparams; ++i)
|
||||
{
|
||||
if (params[i] == NULL ||
|
||||
!png_check_fp_string(params[i], strlen(params[i])))
|
||||
png_error(png_ptr, "Invalid format for pCAL parameter");
|
||||
{
|
||||
png_chunk_report(png_ptr, "Invalid format for pCAL parameter",
|
||||
PNG_CHUNK_WRITE_ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
info_ptr->pcal_purpose = png_voidcast(png_charp,
|
||||
@ -306,8 +318,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
|
||||
if (info_ptr->pcal_purpose == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Insufficient memory for pCAL purpose");
|
||||
|
||||
png_chunk_report(png_ptr, "Insufficient memory for pCAL purpose",
|
||||
PNG_CHUNK_WRITE_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -336,7 +348,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
memcpy(info_ptr->pcal_units, units, length);
|
||||
|
||||
info_ptr->pcal_params = png_voidcast(png_charpp, png_malloc_warn(png_ptr,
|
||||
(png_size_t)((nparams + 1) * (sizeof (png_charp)))));
|
||||
(png_size_t)(((unsigned int)nparams + 1) * (sizeof (png_charp)))));
|
||||
|
||||
if (info_ptr->pcal_params == NULL)
|
||||
{
|
||||
@ -345,7 +357,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
return;
|
||||
}
|
||||
|
||||
memset(info_ptr->pcal_params, 0, (nparams + 1) * (sizeof (png_charp)));
|
||||
memset(info_ptr->pcal_params, 0, ((unsigned int)nparams + 1) *
|
||||
(sizeof (png_charp)));
|
||||
|
||||
for (i = 0; i < nparams; i++)
|
||||
{
|
||||
@ -568,7 +581,8 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
|
||||
PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))));
|
||||
|
||||
if (num_palette > 0)
|
||||
memcpy(png_ptr->palette, palette, num_palette * (sizeof (png_color)));
|
||||
memcpy(png_ptr->palette, palette, (unsigned int)num_palette *
|
||||
(sizeof (png_color)));
|
||||
info_ptr->palette = png_ptr->palette;
|
||||
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
|
||||
|
||||
@ -1085,7 +1099,7 @@ png_set_sPLT(png_const_structrp png_ptr,
|
||||
* checked it when doing the allocation.
|
||||
*/
|
||||
memcpy(np->entries, entries->entries,
|
||||
entries->nentries * sizeof (png_sPLT_entry));
|
||||
(unsigned int)entries->nentries * sizeof (png_sPLT_entry));
|
||||
|
||||
/* Note that 'continue' skips the advance of the out pointer and out
|
||||
* count, so an invalid entry is not added.
|
||||
@ -1394,7 +1408,7 @@ png_set_unknown_chunk_location(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
{
|
||||
png_app_error(png_ptr, "invalid unknown chunk location");
|
||||
/* Fake out the pre 1.6.0 behavior: */
|
||||
if ((location & PNG_HAVE_IDAT) != 0) /* undocumented! */
|
||||
if (((unsigned int)location & PNG_HAVE_IDAT) != 0) /* undocumented! */
|
||||
location = PNG_AFTER_IDAT;
|
||||
|
||||
else
|
||||
@ -1518,7 +1532,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
||||
return;
|
||||
}
|
||||
|
||||
num_chunks = num_chunks_in;
|
||||
num_chunks = (unsigned int)num_chunks_in;
|
||||
}
|
||||
|
||||
old_num_chunks = png_ptr->num_chunk_list;
|
||||
@ -1708,7 +1722,7 @@ void PNGAPI
|
||||
png_set_invalid(png_const_structrp png_ptr, png_inforp info_ptr, int mask)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
info_ptr->valid &= ~mask;
|
||||
info_ptr->valid &= (unsigned int)(~mask);
|
||||
}
|
||||
|
||||
|
||||
|
@ -263,7 +263,7 @@ struct png_struct_def
|
||||
/* pixel depth used for the row buffers */
|
||||
png_byte transformed_pixel_depth;
|
||||
/* pixel depth after read/write transforms */
|
||||
#if PNG_ZLIB_VERNUM >= 0x1240
|
||||
#if ZLIB_VERNUM >= 0x1240
|
||||
png_byte zstream_start; /* at start of an input zlib stream */
|
||||
#endif /* Zlib >= 1.2.4 */
|
||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* 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.)
|
||||
@ -595,7 +595,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||
return; /* The filler channel has gone already */
|
||||
|
||||
/* Fix the rowbytes value. */
|
||||
row_info->rowbytes = dp-row;
|
||||
row_info->rowbytes = (unsigned int)(dp-row);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -693,7 +693,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
|
||||
* 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;
|
||||
int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
|
||||
png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
|
||||
|
||||
switch (row_info->bit_depth)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* 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.)
|
||||
@ -675,9 +675,9 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||
{
|
||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
|
||||
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
|
||||
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
||||
png_uint_32 s0 = (png_uint_32)(*(rp ) << 8) | *(rp + 1);
|
||||
png_uint_32 s1 = (png_uint_32)(*(rp + 2) << 8) | *(rp + 3);
|
||||
png_uint_32 s2 = (png_uint_32)(*(rp + 4) << 8) | *(rp + 5);
|
||||
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
|
||||
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
|
||||
*(rp ) = (png_byte)(red >> 8);
|
||||
@ -910,7 +910,7 @@ png_set_flush(png_structrp png_ptr, int nrows)
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
png_ptr->flush_dist = (nrows < 0 ? 0 : nrows);
|
||||
png_ptr->flush_dist = (nrows < 0 ? 0 : (png_uint_32)nrows);
|
||||
}
|
||||
|
||||
/* Flush the current output buffers now */
|
||||
@ -1534,7 +1534,8 @@ png_write_image_16bit(png_voidp argument)
|
||||
display->first_row);
|
||||
png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row);
|
||||
png_uint_16p row_end;
|
||||
const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
|
||||
const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ?
|
||||
3 : 1;
|
||||
int aindex = 0;
|
||||
png_uint_32 y = image->height;
|
||||
|
||||
@ -1548,9 +1549,9 @@ png_write_image_16bit(png_voidp argument)
|
||||
++output_row;
|
||||
}
|
||||
else
|
||||
aindex = channels;
|
||||
aindex = (int)channels;
|
||||
# else
|
||||
aindex = channels;
|
||||
aindex = (int)channels;
|
||||
# endif
|
||||
}
|
||||
|
||||
@ -1563,7 +1564,7 @@ png_write_image_16bit(png_voidp argument)
|
||||
*/
|
||||
row_end = output_row + image->width * (channels+1);
|
||||
|
||||
while (y-- > 0)
|
||||
for (; y > 0; --y)
|
||||
{
|
||||
png_const_uint_16p in_ptr = input_row;
|
||||
png_uint_16p out_ptr = output_row;
|
||||
@ -1584,7 +1585,7 @@ png_write_image_16bit(png_voidp argument)
|
||||
if (alpha > 0 && alpha < 65535)
|
||||
reciprocal = ((0xffff<<15)+(alpha>>1))/alpha;
|
||||
|
||||
c = channels;
|
||||
c = (int)channels;
|
||||
do /* always at least one channel */
|
||||
{
|
||||
png_uint_16 component = *in_ptr++;
|
||||
@ -1619,7 +1620,7 @@ png_write_image_16bit(png_voidp argument)
|
||||
}
|
||||
|
||||
png_write_row(png_ptr, png_voidcast(png_const_bytep, display->local_row));
|
||||
input_row += display->row_bytes/(sizeof (png_uint_16));
|
||||
input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -1692,7 +1693,8 @@ png_write_image_8bit(png_voidp argument)
|
||||
display->first_row);
|
||||
png_bytep output_row = png_voidcast(png_bytep, display->local_row);
|
||||
png_uint_32 y = image->height;
|
||||
const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
|
||||
const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ?
|
||||
3 : 1;
|
||||
|
||||
if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
|
||||
{
|
||||
@ -1709,12 +1711,12 @@ png_write_image_8bit(png_voidp argument)
|
||||
|
||||
else
|
||||
# endif
|
||||
aindex = channels;
|
||||
aindex = (int)channels;
|
||||
|
||||
/* Use row_end in place of a loop counter: */
|
||||
row_end = output_row + image->width * (channels+1);
|
||||
|
||||
while (y-- > 0)
|
||||
for (; y > 0; --y)
|
||||
{
|
||||
png_const_uint_16p in_ptr = input_row;
|
||||
png_bytep out_ptr = output_row;
|
||||
@ -1732,7 +1734,7 @@ png_write_image_8bit(png_voidp argument)
|
||||
if (alphabyte > 0 && alphabyte < 255)
|
||||
reciprocal = UNP_RECIPROCAL(alpha);
|
||||
|
||||
c = channels;
|
||||
c = (int)channels;
|
||||
do /* always at least one channel */
|
||||
*out_ptr++ = png_unpremultiply(*in_ptr++, alpha, reciprocal);
|
||||
while (--c > 0);
|
||||
@ -1744,7 +1746,7 @@ png_write_image_8bit(png_voidp argument)
|
||||
|
||||
png_write_row(png_ptr, png_voidcast(png_const_bytep,
|
||||
display->local_row));
|
||||
input_row += display->row_bytes/(sizeof (png_uint_16));
|
||||
input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
|
||||
} /* while y */
|
||||
}
|
||||
|
||||
@ -1755,7 +1757,7 @@ png_write_image_8bit(png_voidp argument)
|
||||
*/
|
||||
png_bytep row_end = output_row + image->width * channels;
|
||||
|
||||
while (y-- > 0)
|
||||
for (; y > 0; --y)
|
||||
{
|
||||
png_const_uint_16p in_ptr = input_row;
|
||||
png_bytep out_ptr = output_row;
|
||||
@ -1769,7 +1771,7 @@ png_write_image_8bit(png_voidp argument)
|
||||
}
|
||||
|
||||
png_write_row(png_ptr, output_row);
|
||||
input_row += display->row_bytes/(sizeof (png_uint_16));
|
||||
input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1786,7 +1788,7 @@ png_image_set_PLTE(png_image_write_control *display)
|
||||
|
||||
/* NOTE: the caller must check for cmap != NULL and entries != 0 */
|
||||
const png_uint_32 format = image->format;
|
||||
const int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
|
||||
const unsigned int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
|
||||
|
||||
# if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
|
||||
defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED)
|
||||
@ -1818,7 +1820,7 @@ png_image_set_PLTE(png_image_write_control *display)
|
||||
{
|
||||
png_const_uint_16p entry = png_voidcast(png_const_uint_16p, cmap);
|
||||
|
||||
entry += i * channels;
|
||||
entry += (unsigned int)i * channels;
|
||||
|
||||
if ((channels & 1) != 0) /* no alpha */
|
||||
{
|
||||
@ -1874,7 +1876,7 @@ png_image_set_PLTE(png_image_write_control *display)
|
||||
{
|
||||
png_const_bytep entry = png_voidcast(png_const_bytep, cmap);
|
||||
|
||||
entry += i * channels;
|
||||
entry += (unsigned int)i * channels;
|
||||
|
||||
switch (channels)
|
||||
{
|
||||
@ -1919,7 +1921,7 @@ png_image_set_PLTE(png_image_write_control *display)
|
||||
png_set_tRNS(image->opaque->png_ptr, image->opaque->info_ptr, tRNS,
|
||||
num_trans, NULL);
|
||||
|
||||
image->colormap_entries = entries;
|
||||
image->colormap_entries = (png_uint_32)entries;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1949,7 +1951,7 @@ png_image_write_main(png_voidp argument)
|
||||
{
|
||||
const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
|
||||
|
||||
if (image->width <= 0x7FFFFFFFU/channels) /* no overflow */
|
||||
if (image->width <= 0x7fffffffU/channels) /* no overflow */
|
||||
{
|
||||
png_uint_32 check;
|
||||
const png_uint_32 png_row_stride = image->width * channels;
|
||||
@ -1958,10 +1960,10 @@ png_image_write_main(png_voidp argument)
|
||||
display->row_stride = (png_int_32)/*SAFE*/png_row_stride;
|
||||
|
||||
if (display->row_stride < 0)
|
||||
check = -display->row_stride;
|
||||
check = (png_uint_32)(-display->row_stride);
|
||||
|
||||
else
|
||||
check = display->row_stride;
|
||||
check = (png_uint_32)display->row_stride;
|
||||
|
||||
if (check >= png_row_stride)
|
||||
{
|
||||
@ -1969,7 +1971,7 @@ png_image_write_main(png_voidp argument)
|
||||
* limits the whole image size to 32 bits for API compatibility with
|
||||
* the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro.
|
||||
*/
|
||||
if (image->height > 0xFFFFFFFF/png_row_stride)
|
||||
if (image->height > 0xffffffffU/png_row_stride)
|
||||
png_error(image->opaque->png_ptr, "memory image too large");
|
||||
}
|
||||
|
||||
@ -2145,7 +2147,7 @@ png_image_write_main(png_voidp argument)
|
||||
ptrdiff_t row_bytes = display->row_bytes;
|
||||
png_uint_32 y = image->height;
|
||||
|
||||
while (y-- > 0)
|
||||
for (; y > 0; --y)
|
||||
{
|
||||
png_write_row(png_ptr, row);
|
||||
row += row_bytes;
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||
*
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* 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.)
|
||||
@ -177,7 +177,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
||||
if (row_info->color_type != PNG_COLOR_TYPE_PALETTE)
|
||||
{
|
||||
int shift_start[4], shift_dec[4];
|
||||
int channels = 0;
|
||||
unsigned int channels = 0;
|
||||
|
||||
if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* 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.)
|
||||
@ -408,7 +408,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
|
||||
png_ptr->zstream.avail_out = 0;
|
||||
|
||||
/* Now initialize if required, setting the new parameters, otherwise just
|
||||
* to a simple reset to the previous parameters.
|
||||
* do a simple reset to the previous parameters.
|
||||
*/
|
||||
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
|
||||
ret = deflateReset(&png_ptr->zstream);
|
||||
@ -1197,7 +1197,7 @@ png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette)
|
||||
png_byte new_name[80];
|
||||
png_byte entrybuf[10];
|
||||
png_size_t entry_size = (spalette->depth == 8 ? 6 : 10);
|
||||
png_size_t palette_size = entry_size * spalette->nentries;
|
||||
png_size_t palette_size = entry_size * (png_size_t)spalette->nentries;
|
||||
png_sPLT_entryp ep;
|
||||
#ifndef PNG_POINTER_INDEXING_SUPPORTED
|
||||
int i;
|
||||
@ -1764,7 +1764,7 @@ png_write_pCAL(png_structrp png_ptr, png_charp purpose, png_int_32 X0,
|
||||
total_len = purpose_len + units_len + 10;
|
||||
|
||||
params_len = (png_size_tp)png_malloc(png_ptr,
|
||||
(png_alloc_size_t)(nparams * (sizeof (png_size_t))));
|
||||
(png_alloc_size_t)((png_alloc_size_t)nparams * (sizeof (png_size_t))));
|
||||
|
||||
/* Find the length of each parameter, making sure we don't count the
|
||||
* null terminator for the last parameter.
|
||||
@ -2352,7 +2352,7 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
png_bytep rp, dp, lp;
|
||||
png_size_t i;
|
||||
png_size_t sum = 0;
|
||||
int v;
|
||||
unsigned int v;
|
||||
|
||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB;
|
||||
|
||||
@ -2361,7 +2361,7 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
{
|
||||
v = *dp = *rp;
|
||||
#ifdef PNG_USE_ABS
|
||||
sum += 128 - abs(v - 128);
|
||||
sum += 128 - abs((int)v - 128);
|
||||
#else
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
#endif
|
||||
@ -2372,7 +2372,7 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
{
|
||||
v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
|
||||
#ifdef PNG_USE_ABS
|
||||
sum += 128 - abs(v - 128);
|
||||
sum += 128 - abs((int)v - 128);
|
||||
#else
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
#endif
|
||||
@ -2413,7 +2413,7 @@ png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
|
||||
png_bytep rp, dp, pp;
|
||||
png_size_t i;
|
||||
png_size_t sum = 0;
|
||||
int v;
|
||||
unsigned int v;
|
||||
|
||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_UP;
|
||||
|
||||
@ -2423,7 +2423,7 @@ png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
|
||||
{
|
||||
v = *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
|
||||
#ifdef PNG_USE_ABS
|
||||
sum += 128 - abs(v - 128);
|
||||
sum += 128 - abs((int)v - 128);
|
||||
#else
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
#endif
|
||||
@ -2457,7 +2457,7 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
png_bytep rp, dp, pp, lp;
|
||||
png_uint_32 i;
|
||||
png_size_t sum = 0;
|
||||
int v;
|
||||
unsigned int v;
|
||||
|
||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG;
|
||||
|
||||
@ -2467,7 +2467,7 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
|
||||
|
||||
#ifdef PNG_USE_ABS
|
||||
sum += 128 - abs(v - 128);
|
||||
sum += 128 - abs((int)v - 128);
|
||||
#else
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
#endif
|
||||
@ -2479,7 +2479,7 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
& 0xff);
|
||||
|
||||
#ifdef PNG_USE_ABS
|
||||
sum += 128 - abs(v - 128);
|
||||
sum += 128 - abs((int)v - 128);
|
||||
#else
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
#endif
|
||||
@ -2519,7 +2519,7 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
png_bytep rp, dp, pp, cp, lp;
|
||||
png_size_t i;
|
||||
png_size_t sum = 0;
|
||||
int v;
|
||||
unsigned int v;
|
||||
|
||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH;
|
||||
|
||||
@ -2529,7 +2529,7 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
|
||||
|
||||
#ifdef PNG_USE_ABS
|
||||
sum += 128 - abs(v - 128);
|
||||
sum += 128 - abs((int)v - 128);
|
||||
#else
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
#endif
|
||||
@ -2562,7 +2562,7 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
|
||||
|
||||
#ifdef PNG_USE_ABS
|
||||
sum += 128 - abs(v - 128);
|
||||
sum += 128 - abs((int)v - 128);
|
||||
#else
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
#endif
|
||||
@ -2685,14 +2685,14 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
png_bytep rp;
|
||||
png_size_t sum = 0;
|
||||
png_size_t i;
|
||||
int v;
|
||||
unsigned int v;
|
||||
|
||||
{
|
||||
for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
|
||||
{
|
||||
v = *rp;
|
||||
#ifdef PNG_USE_ABS
|
||||
sum += 128 - abs(v - 128);
|
||||
sum += 128 - abs((int)v - 128);
|
||||
#else
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user