diff options
author | George Hazan <ghazan@miranda.im> | 2017-08-04 13:13:55 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-08-04 13:13:55 +0300 |
commit | 200dedbe5840fa9fb7e7f24c96d12458f296dc0d (patch) | |
tree | 7643b63e58da41265ae50e714e21dcb4e17eddb7 /plugins | |
parent | a98c9c3e38deb040415cb57003c634e718b6d64b (diff) |
update to libpng 1.6.31
Diffstat (limited to 'plugins')
27 files changed, 779 insertions, 265 deletions
diff --git a/plugins/AdvaImg/src/LibPNG/ANNOUNCE b/plugins/AdvaImg/src/LibPNG/ANNOUNCE index 639388bf67..db2329684f 100644 --- a/plugins/AdvaImg/src/LibPNG/ANNOUNCE +++ b/plugins/AdvaImg/src/LibPNG/ANNOUNCE @@ -1,4 +1,4 @@ -Libpng 1.6.29 - March 16, 2017
+Libpng 1.6.31 - July 27, 2017
This is a public release of libpng, intended for use in production codes.
@@ -7,37 +7,51 @@ Files available for download: Source files with LF line endings (for Unix/Linux) and with a
"configure" script
- libpng-1.6.29.tar.xz (LZMA-compressed, recommended)
- libpng-1.6.29.tar.gz
+ libpng-1.6.31.tar.xz (LZMA-compressed, recommended)
+ libpng-1.6.31.tar.gz
Source files with CRLF line endings (for Windows), without the
"configure" script
- lpng1629.7z (LZMA-compressed, recommended)
- lpng1629.zip
+ lpng1631.7z (LZMA-compressed, recommended)
+ lpng1631.zip
Other information:
- libpng-1.6.29-README.txt
- libpng-1.6.29-LICENSE.txt
- libpng-1.6.29-*.asc (armored detached GPG signatures)
-
-Changes since the last public release (1.6.28):
-
- Readded "include(GNUInstallDirs)" to CMakeLists.txt (Gianfranco Costamagna).
- Moved SSE2 optimization code into the main libpng source directory.
- Configure libpng with "configure --enable-intel-sse" or compile
- libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it.
- Simplified conditional compilation in pngvalid.c, for AIX (Michael Felt).
- Avoid conditional directives that break statements in pngrutil.c (Romero
- Malaquias)
- The contrib/examples/pngtopng.c recovery code was in the wrong "if"
- branches; the comments were correct.
- Added code for PowerPC VSX optimisation (Vadim Barkov).
- Avoid potential overflow of shift operations in png_do_expand() (Aaron Boxer).
- Change test ZLIB_VERNUM >= 0x1281 to ZLIB_VERNUM >= 0x1290 in pngrutil.c
- because Solaris 11 distributes zlib-1.2.8.f that is older than 1.2.8.1.
- Suppress clang warnings about implicit sign changes in png.c
+ libpng-1.6.31-README.txt
+ libpng-1.6.31-LICENSE.txt
+ libpng-1.6.31-*.asc (armored detached GPG signatures)
+
+Changes since the last public release (1.6.30):
+
+ Guard the definition of _POSIX_SOURCE in pngpriv.h (AIX already defines it;
+ bug report by Michael Felt).
+ Revised pngpriv.h to work around failure to compile arm/filter_neon.S
+ ("typedef" directive is unrecognized by the assembler). The problem
+ was introduced in libpng-1.6.30beta01.
+ Added "Requires: zlib" to libpng.pc.in (Pieter Neerincx).
+ Added special case for FreeBSD in arm/filter_neon.S (Maya Rashish).
+ Added instructions for disabling hardware optimizations in INSTALL.
+ Added "--enable-hardware-optimizations" configuration flag to enable
+ or disable all hardware optimizations with one flag.
+ Updated CMakeLists.txt to add INTEL_SSE and MIPS_MSA platforms.
+ Changed "int" to "png_size_t" in intel/filter_sse2.c to prevent
+ possible integer overflow (Bug report by John Bowler).
+ Quieted "declaration after statement" warnings in intel/filter_sse2.c.
+ Added scripts/makefile-linux-opt, which has hardware optimizations enabled.
+ Removed one of the GCC-7.1.0 'strict-overflow' warnings that result when
+ integers appear on both sides of a compare. Worked around the others by
+ forcing the strict-overflow setting in the relevant functions to a level
+ where they are not reported (John Bowler).
+ Changed "FALL THROUGH" comments to "FALLTHROUGH" because GCC doesn't like
+ the space.
+ Worked around some C-style casts from (void*) because g++ 5.4.0 objects
+ to them.
+ Increased the buffer size for 'sprint' to pass the gcc 7.1.0 'sprint
+ overflow' check that is on by default with -Wall -Wextra.
+ Added eXIf chunk support.
+ Added a minimal eXIf chunk (with Orientation and FocalLengthIn35mmFilm
+ tags) to pngtest.png.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
diff --git a/plugins/AdvaImg/src/LibPNG/CHANGES b/plugins/AdvaImg/src/LibPNG/CHANGES index 62ab676da4..6447bbb3c6 100644 --- a/plugins/AdvaImg/src/LibPNG/CHANGES +++ b/plugins/AdvaImg/src/LibPNG/CHANGES @@ -5761,7 +5761,9 @@ Version 1.6.27beta01 [November 2, 2016] if built with zlib-1.2.8.1.
Version 1.6.27rc01 [December 27, 2016]
- Control ADLER32 checking with new PNG_IGNORE_ADLER32 option.
+ Control ADLER32 checking with new PNG_IGNORE_ADLER32 option. Fixes
+ an endless loop when handling erroneous ADLER32 checksums; bug
+ introduced in libpng-1.6.26.
Removed the use of a macro containing the pre-processor 'defined'
operator. It is unclear whether this is valid; a macro that
"generates" 'defined' is not permitted, but the use of the word
@@ -5811,12 +5813,101 @@ Version 1.6.29beta02 [February 22, 2017] Version 1.6.29beta03 [March 1, 2017]
Avoid potential overflow of shift operations in png_do_expand() (Aaron Boxer).
Change test ZLIB_VERNUM >= 0x1281 to ZLIB_VERNUM >= 0x1290 in pngrutil.c
- because Solaris 11 distributes zlib-1.2.8.f that is older than 1.2.8.1.
+ because Solaris 11 distributes zlib-1.2.8.f that is older than 1.2.8.1,
+ as suggested in zlib FAQ, item 24.
Suppress clang warnings about implicit sign changes in png.c
Version 1.6.29 [March 16, 2017]
No changes.
+Version 1.6.30beta01 [April 1, 2017]
+ Added missing "$(CPPFLAGS)" to the compile line for c.pic.o in
+ makefile.linux and makefile.solaris-x86 (Cosmin).
+ Revised documentation of png_get_error_ptr() in the libpng manual.
+ Silence clang -Wcomma and const drop warnings (Viktor Szakats).
+ Update Sourceforge URLs in documentation (https instead of http).
+
+Version 1.6.30beta02 [April 22, 2017]
+ Document need to check for integer overflow when allocating a pixel
+ buffer for multiple rows in contrib/gregbook, contrib/pngminus,
+ example.c, and in the manual (suggested by Jaeseung Choi). This
+ is similar to the bug reported against pngquant in CVE-2016-5735.
+ Removed reference to the obsolete PNG_SAFE_LIMITS macro in the documentation.
+
+Version 1.6.30beta03 [May 22, 2017]
+ Check for integer overflow in contrib/visupng and contrib/tools/genpng.
+ Do not double evaluate CMAKE_SYSTEM_PROCESSOR in CMakeLists.txt.
+ Test CMAKE_HOST_WIN32 instead of WIN32 in CMakeLists.txt.
+ Fix some URL in documentation.
+
+Version 1.6.30beta04 [June 7, 2017]
+ Avoid writing an empty IDAT when the last IDAT exactly fills the
+ compression buffer (bug report by Brian Baird). This bug was
+ introduced in libpng-1.6.0.
+
+Version 1.6.30rc01 [June 14, 2017]
+ No changes.
+
+Version 1.6.30rc02 [June 25, 2017]
+ Update copyright year in pnglibconf.h, make ltmain.sh executable.
+ Add a reference to the libpng.download site in README.
+
+Version 1.6.30 [June 28, 2017]
+ No changes.
+
+Version 1.6.31beta01 [July 5, 2017]
+ Guard the definition of _POSIX_SOURCE in pngpriv.h (AIX already defines it;
+ bug report by Michael Felt).
+ Revised pngpriv.h to work around failure to compile arm/filter_neon.S
+ ("typedef" directive is unrecognized by the assembler). The problem
+ was introduced in libpng-1.6.30beta01.
+ Added "Requires: zlib" to libpng.pc.in (Pieter Neerincx).
+ Added special case for FreeBSD in arm/filter_neon.S (Maya Rashish).
+
+Version 1.6.31beta02 [July 8, 2017]
+ Added instructions for disabling hardware optimizations in INSTALL.
+ Added "--enable-hardware-optimizations" configuration flag to enable
+ or disable all hardware optimizations with one flag.
+
+Version 1.6.31beta03 [July 9, 2017]
+ Updated CMakeLists.txt to add INTEL_SSE and MIPS_MSA platforms.
+ Changed "int" to "png_size_t" in intel/filter_sse2.c to prevent
+ possible integer overflow (Bug report by John Bowler).
+ Quieted "declaration after statement" warnings in intel/filter_sse2.c.
+ Added scripts/makefile-linux-opt, which has hardware optimizations enabled.
+
+Version 1.6.31beta04 [July 11, 2017]
+ Removed one of the GCC-7.1.0 'strict-overflow' warnings that result when
+ integers appear on both sides of a compare. Worked around the others by
+ forcing the strict-overflow setting in the relevant functions to a level
+ where they are not reported (John Bowler).
+ Changed "FALL THROUGH" comments to "FALLTHROUGH" because GCC doesn't like
+ the space.
+ Worked around some C-style casts from (void*) because g++ 5.4.0 objects
+ to them.
+ Increased the buffer size for 'sprint' to pass the gcc 7.1.0 'sprint
+ overflow' check that is on by default with -Wall -Wextra.
+
+Version 1.6.31beta05 [July 13, 2017]
+ Added eXIf chunk support.
+
+Version 1.6.31beta06 [July 17, 2017]
+ Added a minimal eXIf chunk (with Orientation and FocalLengthIn35mmFilm
+ tags) to pngtest.png.
+
+Version 1.6.31beta07 [July 18, 2017]
+ Revised the eXIf chunk in pngtest.png to fix "Bad IFD1 Directory" warning.
+
+Version 1.6.31rc01 [July 19, 2017]
+ No changes.
+
+Version 1.6.31rc02 [July 25, 2017]
+ Fixed typo in example.c (png_free_image should be png_image_free) (Bug
+ report by John Smith)
+
+Version 1.6.31 [July 27, 2017]
+ No changes.
+
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/plugins/AdvaImg/src/LibPNG/INSTALL b/plugins/AdvaImg/src/LibPNG/INSTALL index be125a9a58..ebc18bfbf5 100644 --- a/plugins/AdvaImg/src/LibPNG/INSTALL +++ b/plugins/AdvaImg/src/LibPNG/INSTALL @@ -16,10 +16,11 @@ Contents XI. Prepending a prefix to exported symbols
XII. Configuring for compiler xxx:
XIII. Removing unwanted object code
- XIV. Changes to the build and configuration of libpng in libpng-1.5.x
- XV. Setjmp/longjmp issues
- XVI. Common linking failures
- XVII. Other sources of information about libpng
+ XIV. Enabling or disabling hardware optimizations
+ XV. Changes to the build and configuration of libpng in libpng-1.5.x
+ XVI. Setjmp/longjmp issues
+ XVII. Common linking failures
+ XVIII. Other sources of information about libpng
I. Simple installation
@@ -78,8 +79,8 @@ Or you can use one of the "projects" in the "projects" directory. Before installing libpng, you must first install zlib, if it
is not already on your system. zlib can usually be found
-wherever you got libpng; otherwise go to http://zlib.net. You can place
-zlib in the same directory as libpng or in another directory.
+wherever you got libpng; otherwise go to https://zlib.net/. You can
+place zlib in the same directory as libpng or in another directory.
If your system already has a preinstalled zlib you will still need
to have access to the zlib.h and zconf.h include files that
@@ -281,7 +282,57 @@ library to fail if they call functions not available in your library. The size of the library itself should not be an issue, because only
those sections that are actually used will be loaded into memory.
-XIV. Changes to the build and configuration of libpng in libpng-1.5.x
+XIV. Enabling or disabling hardware optimizations
+
+Certain hardware capabilites, such as the Intel SSE instructions,
+are normally detected at run time. Enable them with configure options
+such as one of
+
+ --enable-arm-neon=yes
+ --enable-mips-msa=yes
+ --enable-intel-sse=yes
+ --enable-powerpc-vsx=yes
+
+or enable them all at once with
+
+ --enable-hardware-optimizations=yes
+
+or, if you are not using "configure", you can use one
+or more of
+
+ CPPFLAGS += "-DPNG_ARM_NEON"
+ CPPFLAGS += "-DPNG_MIPS_MSA"
+ CPPFLAGS += "-DPNG_INTEL_SSE"
+ CPPFLAGS += "-DPNG_POWERPC_VSX"
+
+See for example scripts/makefile.linux-opt
+
+If you wish to avoid using them,
+you can disable them via the configure option
+
+ --disable-hardware-optimizations
+
+to disable them all, or
+
+ --enable-intel-sse=no
+
+to disable a particular one,
+or via compiler-command options such as
+
+ CPPFLAGS += "-DPNG_ARM_NEON_OPT=0, -DPNG_MIPS_MSA_OPT=0,
+ -DPNG_INTEL_SSE_OPT=0, -DPNG_POWERPC_VSX_OPT=0"
+
+If you are using cmake, hardware optimizations are "on"
+by default. To disable them, use
+
+ cmake . -DPNG_ARM_NEON=no -DPNG_INTEL_SSE=no \
+ -DPNG_MIPS_MSA=no -DPNG_POWERPC_VSX=no
+
+or disable them all at once with
+
+ cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no
+
+XV. Changes to the build and configuration of libpng in libpng-1.5.x
Details of internal changes to the library code can be found in the CHANGES
file and in the GIT repository logs. These will be of no concern to the vast
@@ -372,7 +423,7 @@ $PREFIX/include directory). Do not edit pnglibconf.h after you have built libpng, because than the settings would not accurately reflect the settings
that were used to build libpng.
-XV. Setjmp/longjmp issues
+XVI. Setjmp/longjmp issues
Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp()
is known to be not thread-safe on some platforms and we don't know of
@@ -390,7 +441,7 @@ This requires setjmp/longjmp, so you must either build the library with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
-XVI. Common linking failures
+XVII. Common linking failures
If your application fails to find libpng or zlib entries while linking:
@@ -402,7 +453,7 @@ If your application fails to find libpng or zlib entries while linking: If you are using the vstudio project, observe the WARNING in
project/vstudio/README.txt.
-XVII. Other sources of information about libpng:
+XVIII. Other sources of information about libpng:
Further information can be found in the README and libpng-manual.txt
files, in the individual makefiles, in png.h, and the manual pages
diff --git a/plugins/AdvaImg/src/LibPNG/LICENSE b/plugins/AdvaImg/src/LibPNG/LICENSE index 1219739dbe..028d49788f 100644 --- a/plugins/AdvaImg/src/LibPNG/LICENSE +++ b/plugins/AdvaImg/src/LibPNG/LICENSE @@ -10,7 +10,7 @@ this sentence. This code is released under the libpng license.
-libpng versions 1.0.7, July 1, 2000 through 1.6.29, March 16, 2017 are
+libpng versions 1.0.7, July 1, 2000 through 1.6.31, July 27, 2017 are
Copyright (c) 2000-2002, 2004, 2006-2017 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
@@ -130,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-March 16, 2017
+April 1, 2017
diff --git a/plugins/AdvaImg/src/LibPNG/README b/plugins/AdvaImg/src/LibPNG/README index 2b648f93bd..87edc77615 100644 --- a/plugins/AdvaImg/src/LibPNG/README +++ b/plugins/AdvaImg/src/LibPNG/README @@ -1,4 +1,4 @@ -README for libpng version 1.6.29 - March 16, 2017 (shared library 16.0)
+README for libpng version 1.6.31 - July 27, 2017 (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.
@@ -23,7 +23,7 @@ earlier versions if you are using a shared library. The type of the png_uint_32, which will affect shared-library applications that use
this function.
-To avoid problems with changes to the internals of png info_struct,
+To avoid problems with changes to the internals of the png info_struct,
new APIs have been made available in 0.95 to avoid direct application
access to info_ptr. These functions are the png_set_<chunk> and
png_get_<chunk> functions. These functions should be used when
@@ -88,11 +88,11 @@ zlib should be available at the same place that libpng is, or at zlib.net. You may also want a copy of the PNG specification. It is available
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
-these at http://www.libpng.org/pub/png/documents/
+these at http://www.libpng.org/pub/png/pngdocs.html .
-This code is currently being archived at libpng.sf.net in the
-[DOWNLOAD] area, and at ftp://ftp.simplesystems.org. If you can't find it
-in any of those places, e-mail me, and I'll help you find it.
+This code is currently being archived at libpng.sourceforge.io in the
+[DOWNLOAD] area, and at http://libpng.download/src . If you
+can't find it in any of those places, e-mail me, and I'll help you find it.
I am not a lawyer, but I believe that the Export Control Classification
Number (ECCN) for libpng is EAR99, which means not subject to export
diff --git a/plugins/AdvaImg/src/LibPNG/configure b/plugins/AdvaImg/src/LibPNG/configure index ccc33fe438..e69de29bb2 100644 --- a/plugins/AdvaImg/src/LibPNG/configure +++ b/plugins/AdvaImg/src/LibPNG/configure @@ -1,19 +0,0 @@ -
-echo "
- There is no \"configure\" script in this distribution (*.zip or *.7z) of
- libpng-1.6.29.
-
- Instead, please copy the appropriate makefile for your system from the
- \"scripts\" directory. Read the INSTALL file for more details.
-
- Update, July 2004: you can get a \"configure\" based distribution
- from the libpng distribution sites. Download the file
- libpng-1.6.29.tar.gz or libpng-1.6.29.tar.xz.
-
- If the line endings in the files look funny, which is likely to be the
- case if you were trying to run \"configure\" on a Linux machine, you may
- wish to get the other distribution of libpng. It is available in both
- tar.gz/tar.xz (UNIX style line endings, with \"configure\") and .7z/.zip
- (DOS style line endings, without \"configure\") formats.
-"
-
diff --git a/plugins/AdvaImg/src/LibPNG/example.c b/plugins/AdvaImg/src/LibPNG/example.c index 13bb8eb1d3..d0afe51c81 100644 --- a/plugins/AdvaImg/src/LibPNG/example.c +++ b/plugins/AdvaImg/src/LibPNG/example.c @@ -114,13 +114,13 @@ int main(int argc, const char **argv) else
{
- /* Calling png_free_image is optional unless the simplified API was
+ /* Calling png_image_free is optional unless the simplified API was
* not run to completion. In this case if there wasn't enough
* memory for 'buffer' we didn't complete the read, so we must free
* the image:
*/
if (buffer == NULL)
- png_free_image(&image);
+ png_image_free(&image);
else
free(buffer);
@@ -983,6 +983,11 @@ void write_png(char *file_name /* , ... other image information ... */) png_uint_32 k, height, width;
/* In this example, "image" is a one-dimensional array of bytes */
+
+ /* Guard against integer overflow */
+ if (height > PNG_SIZE_MAX/(width*bytes_per_pixel)) {
+ png_error(png_ptr, "Image_data buffer would be too large");
+ }
png_byte image[height*width*bytes_per_pixel];
png_bytep row_pointers[height];
diff --git a/plugins/AdvaImg/src/LibPNG/libpng-manual.txt b/plugins/AdvaImg/src/LibPNG/libpng-manual.txt index ad6125e094..e62905ae50 100644 --- a/plugins/AdvaImg/src/LibPNG/libpng-manual.txt +++ b/plugins/AdvaImg/src/LibPNG/libpng-manual.txt @@ -1,9 +1,9 @@ libpng-manual.txt - A description on how to use and modify libpng
- libpng version 1.6.29 - March 16, 2017
+ libpng version 1.6.31 - July 27, 2017
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
- Copyright (c) 1998-2016 Glenn Randers-Pehrson
+ Copyright (c) 1998-2017 Glenn Randers-Pehrson
This document is released under the libpng license.
For conditions of distribution and use, see the disclaimer
@@ -11,9 +11,9 @@ libpng-manual.txt - A description on how to use and modify libpng Based on:
- libpng versions 0.97, January 1998, through 1.6.29 - March 16, 2017
+ libpng versions 0.97, January 1998, through 1.6.31 - July 27, 2017
Updated and distributed by Glenn Randers-Pehrson
- Copyright (c) 1998-2016 Glenn Randers-Pehrson
+ Copyright (c) 1998-2017 Glenn Randers-Pehrson
libpng 1.0 beta 6 - version 0.96 - May 28, 1997
Updated and distributed by Andreas Dilger
@@ -66,17 +66,17 @@ file format in application programs. The PNG specification (second edition), November 2003, is available as
a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2004 (E)) at
-<http://www.w3.org/TR/2003/REC-PNG-20031110/
+<https://www.w3.org/TR/2003/REC-PNG-20031110/
The W3C and ISO documents have identical technical content.
The PNG-1.2 specification is available at
-<http://png-mng.sourceforge.net/pub/png/spec/1.2/>.
+<https://png-mng.sourceforge.io/pub/png/spec/1.2/>.
It is technically equivalent
to the PNG specification (second edition) but has some additional material.
-The PNG-1.0 specification is available as RFC 2083
-<http://png-mng.sourceforge.net/pub/png/spec/1.0/> and as a
-W3C Recommendation <http://www.w3.org/TR/REC-png-961001>.
+The PNG-1.0 specification is available as RFC 2083
+<https://png-mng.sourceforge.io/pub/png/spec/1.0/> and as a
+W3C Recommendation <https://www.w3.org/TR/REC-png-961001>.
Some additional chunks are described in the special-purpose public chunks
documents at <http://www.libpng.org/pub/png/spec/register/>
@@ -101,7 +101,7 @@ majority of the needs of its users. Libpng uses zlib for its compression and decompression of PNG files.
Further information about zlib, and the latest version of zlib, can
-be found at the zlib home page, <http://zlib.net/>.
+be found at the zlib home page, <https://zlib.net/>.
The zlib compression utility is a general purpose utility that is
useful for more than PNG files, and can be used without libpng.
See the documentation delivered with zlib for more details.
@@ -1190,7 +1190,20 @@ row_pointers prior to calling png_read_png() with png_set_rows(png_ptr, info_ptr, &row_pointers);
Alternatively you could allocate your image in one big block and define
-row_pointers[i] to point into the proper places in your block.
+row_pointers[i] to point into the proper places in your block, but first
+be sure that your platform is able to allocate such a large buffer:
+
+ /* Guard against integer overflow */
+ if (height > PNG_SIZE_MAX/(width*pixel_size)) {
+ png_error(png_ptr,"image_data buffer would be too large");
+ }
+
+ png_bytep buffer=png_malloc(png_ptr,height*width*pixel_size);
+
+ for (int i=0; i<height, i++)
+ row_pointers[i]=buffer+i*width*pixel_size;
+
+ png_set_rows(png_ptr, info_ptr, &row_pointers);
If you use png_set_rows(), the application is responsible for freeing
row_pointers (and row_pointers[i], if they were separately allocated).
@@ -1317,6 +1330,11 @@ in until png_read_end() has read the chunk data following the image. rowbytes = png_get_rowbytes(png_ptr, info_ptr);
rowbytes - number of bytes needed to hold a row
+ This value, the bit_depth, color_type,
+ and the number of channels can change
+ if you use transforms such as
+ png_set_expand(). See
+ png_read_update_info(), below.
signature = png_get_signature(png_ptr, info_ptr);
@@ -1435,6 +1453,11 @@ png_set_rgb_to_gray()). the single transparent color for
non-paletted images (PNG_INFO_tRNS)
+ png_get_eXIf(png_ptr, info_ptr, &exif);
+ (PNG_INFO_eXIf)
+
+ exif - Exif profile (array of png_byte)
+
png_get_hIST(png_ptr, info_ptr, &hist);
(PNG_INFO_hIST)
@@ -2146,6 +2169,16 @@ are allocating one large chunk, you will need to build an array of pointers to each row, as it will be needed for some
of the functions below.
+Be sure that your platform can allocate the buffer that you'll need.
+libpng internally checks for oversize width, but you'll need to
+do your own check for number_of_rows*width*pixel_size if you are using
+a multiple-row buffer:
+
+ /* Guard against integer overflow */
+ if (number_of_rows > PNG_SIZE_MAX/(width*pixel_size)) {
+ png_error(png_ptr,"image_data buffer would be too large");
+ }
+
Remember: Before you call png_read_update_info(), the png_get_*()
functions return the values corresponding to the original PNG image.
After you call png_read_update_info the values refer to the image
@@ -2470,6 +2503,7 @@ your application instead of by libpng, you can use PNG_INFO_gAMA, PNG_INFO_sBIT,
PNG_INFO_cHRM, PNG_INFO_PLTE,
PNG_INFO_tRNS, PNG_INFO_bKGD,
+ PNG_INFO_eXIf,
PNG_INFO_hIST, PNG_INFO_pHYs,
PNG_INFO_oFFs, PNG_INFO_tIME,
PNG_INFO_pCAL, PNG_INFO_sRGB,
@@ -3069,6 +3103,11 @@ width, height, bit_depth, and color_type must be the same in each call. single transparent color for
non-paletted images (PNG_INFO_tRNS)
+ png_set_eXIf(png_ptr, info_ptr, exif);
+
+ hist - Exif profile (array of
+ png_byte) (PNG_INFO_eXIf)
+
png_set_hIST(png_ptr, info_ptr, hist);
hist - histogram of palette (array of
@@ -3824,7 +3863,7 @@ PNG_FORMAT_FLAG_LINEAR flag below. When the simplified API needs to convert between sRGB and linear colorspaces,
the actual sRGB transfer curve defined in the sRGB specification (see the
-article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
+article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
approximation used elsewhere in libpng.
When an alpha channel is present it is expected to denote pixel coverage
@@ -4088,7 +4127,7 @@ READ APIs When the simplified API needs to convert between sRGB and linear colorspaces,
the actual sRGB transfer curve defined in the sRGB specification (see the
-article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
+article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
approximation used elsewhere in libpng.
WRITE APIS
@@ -4246,8 +4285,6 @@ functions after png_create_*_struct() has been called by calling: png_voidp error_ptr, png_error_ptr error_fn,
png_error_ptr warning_fn);
- png_voidp error_ptr = png_get_error_ptr(png_ptr);
-
If NULL is supplied for either error_fn or warning_fn, then the libpng
default function will be used, calling fprintf() and/or longjmp() if a
problem is encountered. The replacement error functions should have
@@ -4259,6 +4296,11 @@ parameters as follows: void user_warning_fn(png_structp png_ptr,
png_const_charp warning_msg);
+Then, within your user_error_fn or user_warning_fn, you can retrieve
+the error_ptr if you need it, by calling
+
+ png_voidp error_ptr = png_get_error_ptr(png_ptr);
+
The motivation behind using setjmp() and longjmp() is the C++ throw and
catch exception handling methods. This makes the code much easier to write,
as there is no need to check every return code of every function call.
@@ -4266,7 +4308,7 @@ However, there are some uncertainties about the status of local variables after a longjmp, so the user may want to be careful about doing anything
after setjmp returns non-zero besides returning itself. Consult your
compiler documentation for more details. For an alternative approach, you
-may wish to use the "cexcept" facility (see http://cexcept.sourceforge.net),
+may wish to use the "cexcept" facility (see https://cexcept.sourceforge.io/),
which is illustrated in pngvalid.c and in contrib/visupng.
Beginning in libpng-1.4.0, the png_set_benign_errors() API became available.
@@ -4494,7 +4536,7 @@ in a MNG datastream. As a minimum, it must have the MNG 8-byte signature and the MHDR and MEND chunks. Libpng does not provide support for these
or any other MNG chunks; your application must provide its own support for
them. You may wish to consider using libmng (available at
-http://www.libmng.com) instead.
+https://www.libmng.com/) instead.
VIII. Changes to Libpng from version 0.88
@@ -4917,18 +4959,14 @@ PNG_USER_WIDTH_MAX and PNG_USER_HEIGHT_MAX, although this document said that it could be used to override them. Now this function will reduce or
increase the limits.
-Starting in libpng-1.5.10, the user limits can be set en masse with the
-configuration option PNG_SAFE_LIMITS_SUPPORTED. If this option is enabled,
-a set of "safe" limits is applied in pngpriv.h. These can be overridden by
-application calls to png_set_user_limits(), png_set_user_chunk_cache_max(),
-and/or png_set_user_malloc_max() that increase or decrease the limits. Also,
-in libpng-1.5.10 the default width and height limits were increased
-from 1,000,000 to 0x7fffffff (i.e., made unlimited). Therefore, the
-limits are now
- default safe
+Starting in libpng-1.5.22, default user limits were established. These
+can be overridden by application calls to png_set_user_limits(),
+png_set_user_chunk_cache_max(), and/or png_set_user_malloc_max().
+The limits are now
+ max possible default
png_user_width_max 0x7fffffff 1,000,000
png_user_height_max 0x7fffffff 1,000,000
- png_user_chunk_cache_max 0 (unlimited) 128
+ png_user_chunk_cache_max 0 (unlimited) 1000
png_user_chunk_malloc_max 0 (unlimited) 8,000,000
The png_set_option() function (and the "options" member of the png struct) was
@@ -5178,6 +5216,11 @@ is an error. Previously this requirement of the PNG specification was not enforced, and the palette was always limited to 256 entries. An over-length
PLTE chunk found in an input PNG is silently truncated.
+Starting with libpng-1.6.31, the eXIf chunk is supported. Libpng does not
+attempt to decode the Exif profile; it simply returns a byte array
+containing the profile to the calling application which must do its own
+decoding.
+
XIII. Detecting libpng
The png_get_io_ptr() function has been present since libpng-0.88, has never
@@ -5194,27 +5237,33 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files going back to version 0.70. You can access the git repository (read only)
at
- git://git.code.sf.net/p/libpng/code
+ https://github.com/glennrp/libpng or
+ https://git.code.sf.net/p/libpng/code.git
-or you can browse it with a web browser by selecting the "code" button at
+or you can browse it with a web browser at
- https://sourceforge.net/projects/libpng
+ https://github.com/glennrp/libpng or
+ https://sourceforge.net/p/libpng/code/ci/libpng16/tree/
Patches can be sent to glennrp at users.sourceforge.net or to
png-mng-implement at lists.sourceforge.net or you can upload them to
the libpng bug tracker at
- http://libpng.sourceforge.net
+ https://libpng.sourceforge.io/
+
+or as a "pull request" to
+
+ https://github.com/glennrp/libpng/pulls
We also accept patches built from the tar or zip distributions, and
simple verbal discriptions of bug fixes, reported either to the
SourceForge bug tracker, to the png-mng-implement at lists.sf.net
-mailing list, or directly to glennrp.
+mailing list, as github issues, or directly to glennrp.
XV. Coding style
Our coding style is similar to the "Allman" style
-(See http://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly
+(See https://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly
braces on separate lines:
if (condition)
@@ -5315,7 +5364,7 @@ Prior to libpng-1.6.0 we used a "png_sizeof()" macro, formatted as though it were a function.
Control keywords if, for, while, and switch are always followed by a space
-to distinguish them from function calls, which have no trailing space.
+to distinguish them from function calls, which have no trailing space.
We put a space after each comma and after each semicolon
in "for" statements, and we put spaces before and after each
@@ -5341,7 +5390,7 @@ 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, and for pointers
-we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)".
+we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)".
We do not use the TAB character for indentation in the C sources.
@@ -5355,7 +5404,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.29 are Y2K compliant. It is my belief that earlier
+upward through 1.6.31 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
diff --git a/plugins/AdvaImg/src/LibPNG/libpng.3 b/plugins/AdvaImg/src/LibPNG/libpng.3 index cbca088175..c2aae81db7 100644 --- a/plugins/AdvaImg/src/LibPNG/libpng.3 +++ b/plugins/AdvaImg/src/LibPNG/libpng.3 @@ -1,6 +1,6 @@ -.TH LIBPNG 3 "March 16, 2017"
+.TH LIBPNG 3 "July 27, 2017"
.SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.6.29
+libpng \- Portable Network Graphics (PNG) Reference Library 1.6.31
.SH SYNOPSIS
\fB
#include <png.h>\fP
@@ -97,6 +97,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.29 \fBpng_byte png_get_header_version (png_const_structp \fIpng_ptr\fP\fB);\fP
+\fBpng_uint_32 png_get_eXIf (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fI*exif\fP\fB);\fP
+
\fBpng_uint_32 png_get_hIST (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fI*hist\fP\fB);\fP
\fBpng_uint_32 png_get_iCCP (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_charpp \fP\fIname\fP\fB, int \fP\fI*compression_type\fP\fB, png_bytepp \fP\fIprofile\fP\fB, png_uint_32 \fI*proflen\fP\fB);\fP
@@ -347,6 +349,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.29 \fBvoid png_set_gray_to_rgb (png_structp \fIpng_ptr\fP\fB);\fP
+\fBvoid png_set_eXIf (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fIexif\fP\fB);\fP
+
\fBvoid png_set_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fIhist\fP\fB);\fP
\fBvoid png_set_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_const_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_const_bytep \fP\fIprofile\fP\fB, png_uint_32 \fIproflen\fP\fB);\fP
@@ -510,10 +514,10 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng. .SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng
- libpng version 1.6.29 - March 16, 2017
+ libpng version 1.6.31 - July 27, 2017
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
- Copyright (c) 1998-2016 Glenn Randers-Pehrson
+ Copyright (c) 1998-2017 Glenn Randers-Pehrson
This document is released under the libpng license.
For conditions of distribution and use, see the disclaimer
@@ -521,9 +525,9 @@ libpng-manual.txt - A description on how to use and modify libpng Based on:
- libpng versions 0.97, January 1998, through 1.6.29 - March 16, 2017
+ libpng versions 0.97, January 1998, through 1.6.31 - July 27, 2017
Updated and distributed by Glenn Randers-Pehrson
- Copyright (c) 1998-2016 Glenn Randers-Pehrson
+ Copyright (c) 1998-2017 Glenn Randers-Pehrson
libpng 1.0 beta 6 - version 0.96 - May 28, 1997
Updated and distributed by Andreas Dilger
@@ -576,17 +580,17 @@ file format in application programs. The PNG specification (second edition), November 2003, is available as
a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2004 (E)) at
-<http://www.w3.org/TR/2003/REC-PNG-20031110/
+<https://www.w3.org/TR/2003/REC-PNG-20031110/
The W3C and ISO documents have identical technical content.
The PNG-1.2 specification is available at
-<http://png-mng.sourceforge.net/pub/png/spec/1.2/>.
+<https://png-mng.sourceforge.io/pub/png/spec/1.2/>.
It is technically equivalent
to the PNG specification (second edition) but has some additional material.
-The PNG-1.0 specification is available as RFC 2083
-<http://png-mng.sourceforge.net/pub/png/spec/1.0/> and as a
-W3C Recommendation <http://www.w3.org/TR/REC-png-961001>.
+The PNG-1.0 specification is available as RFC 2083
+<https://png-mng.sourceforge.io/pub/png/spec/1.0/> and as a
+W3C Recommendation <https://www.w3.org/TR/REC-png-961001>.
Some additional chunks are described in the special-purpose public chunks
documents at <http://www.libpng.org/pub/png/spec/register/>
@@ -611,7 +615,7 @@ majority of the needs of its users. Libpng uses zlib for its compression and decompression of PNG files.
Further information about zlib, and the latest version of zlib, can
-be found at the zlib home page, <http://zlib.net/>.
+be found at the zlib home page, <https://zlib.net/>.
The zlib compression utility is a general purpose utility that is
useful for more than PNG files, and can be used without libpng.
See the documentation delivered with zlib for more details.
@@ -1700,7 +1704,20 @@ row_pointers prior to calling png_read_png() with png_set_rows(png_ptr, info_ptr, &row_pointers);
Alternatively you could allocate your image in one big block and define
-row_pointers[i] to point into the proper places in your block.
+row_pointers[i] to point into the proper places in your block, but first
+be sure that your platform is able to allocate such a large buffer:
+
+ /* Guard against integer overflow */
+ if (height > PNG_SIZE_MAX/(width*pixel_size)) {
+ png_error(png_ptr,"image_data buffer would be too large");
+ }
+
+ png_bytep buffer=png_malloc(png_ptr,height*width*pixel_size);
+
+ for (int i=0; i<height, i++)
+ row_pointers[i]=buffer+i*width*pixel_size;
+
+ png_set_rows(png_ptr, info_ptr, &row_pointers);
If you use png_set_rows(), the application is responsible for freeing
row_pointers (and row_pointers[i], if they were separately allocated).
@@ -1827,6 +1844,11 @@ in until png_read_end() has read the chunk data following the image. rowbytes = png_get_rowbytes(png_ptr, info_ptr);
rowbytes - number of bytes needed to hold a row
+ This value, the bit_depth, color_type,
+ and the number of channels can change
+ if you use transforms such as
+ png_set_expand(). See
+ png_read_update_info(), below.
signature = png_get_signature(png_ptr, info_ptr);
@@ -1945,6 +1967,11 @@ png_set_rgb_to_gray()). the single transparent color for
non-paletted images (PNG_INFO_tRNS)
+ png_get_eXIf(png_ptr, info_ptr, &exif);
+ (PNG_INFO_eXIf)
+
+ exif - Exif profile (array of png_byte)
+
png_get_hIST(png_ptr, info_ptr, &hist);
(PNG_INFO_hIST)
@@ -2656,6 +2683,16 @@ are allocating one large chunk, you will need to build an array of pointers to each row, as it will be needed for some
of the functions below.
+Be sure that your platform can allocate the buffer that you'll need.
+libpng internally checks for oversize width, but you'll need to
+do your own check for number_of_rows*width*pixel_size if you are using
+a multiple-row buffer:
+
+ /* Guard against integer overflow */
+ if (number_of_rows > PNG_SIZE_MAX/(width*pixel_size)) {
+ png_error(png_ptr,"image_data buffer would be too large");
+ }
+
Remember: Before you call png_read_update_info(), the png_get_*()
functions return the values corresponding to the original PNG image.
After you call png_read_update_info the values refer to the image
@@ -2980,6 +3017,7 @@ your application instead of by libpng, you can use PNG_INFO_gAMA, PNG_INFO_sBIT,
PNG_INFO_cHRM, PNG_INFO_PLTE,
PNG_INFO_tRNS, PNG_INFO_bKGD,
+ PNG_INFO_eXIf,
PNG_INFO_hIST, PNG_INFO_pHYs,
PNG_INFO_oFFs, PNG_INFO_tIME,
PNG_INFO_pCAL, PNG_INFO_sRGB,
@@ -3579,6 +3617,11 @@ width, height, bit_depth, and color_type must be the same in each call. single transparent color for
non-paletted images (PNG_INFO_tRNS)
+ png_set_eXIf(png_ptr, info_ptr, exif);
+
+ hist - Exif profile (array of
+ png_byte) (PNG_INFO_eXIf)
+
png_set_hIST(png_ptr, info_ptr, hist);
hist - histogram of palette (array of
@@ -4334,7 +4377,7 @@ PNG_FORMAT_FLAG_LINEAR flag below. When the simplified API needs to convert between sRGB and linear colorspaces,
the actual sRGB transfer curve defined in the sRGB specification (see the
-article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
+article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
approximation used elsewhere in libpng.
When an alpha channel is present it is expected to denote pixel coverage
@@ -4598,7 +4641,7 @@ READ APIs When the simplified API needs to convert between sRGB and linear colorspaces,
the actual sRGB transfer curve defined in the sRGB specification (see the
-article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
+article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
approximation used elsewhere in libpng.
WRITE APIS
@@ -4756,8 +4799,6 @@ functions after png_create_*_struct() has been called by calling: png_voidp error_ptr, png_error_ptr error_fn,
png_error_ptr warning_fn);
- png_voidp error_ptr = png_get_error_ptr(png_ptr);
-
If NULL is supplied for either error_fn or warning_fn, then the libpng
default function will be used, calling fprintf() and/or longjmp() if a
problem is encountered. The replacement error functions should have
@@ -4769,6 +4810,11 @@ parameters as follows: void user_warning_fn(png_structp png_ptr,
png_const_charp warning_msg);
+Then, within your user_error_fn or user_warning_fn, you can retrieve
+the error_ptr if you need it, by calling
+
+ png_voidp error_ptr = png_get_error_ptr(png_ptr);
+
The motivation behind using setjmp() and longjmp() is the C++ throw and
catch exception handling methods. This makes the code much easier to write,
as there is no need to check every return code of every function call.
@@ -4776,7 +4822,7 @@ However, there are some uncertainties about the status of local variables after a longjmp, so the user may want to be careful about doing anything
after setjmp returns non-zero besides returning itself. Consult your
compiler documentation for more details. For an alternative approach, you
-may wish to use the "cexcept" facility (see http://cexcept.sourceforge.net),
+may wish to use the "cexcept" facility (see https://cexcept.sourceforge.io/),
which is illustrated in pngvalid.c and in contrib/visupng.
Beginning in libpng-1.4.0, the png_set_benign_errors() API became available.
@@ -5004,7 +5050,7 @@ in a MNG datastream. As a minimum, it must have the MNG 8-byte signature and the MHDR and MEND chunks. Libpng does not provide support for these
or any other MNG chunks; your application must provide its own support for
them. You may wish to consider using libmng (available at
-http://www.libmng.com) instead.
+https://www.libmng.com/) instead.
.SH VIII. Changes to Libpng from version 0.88
@@ -5427,18 +5473,14 @@ PNG_USER_WIDTH_MAX and PNG_USER_HEIGHT_MAX, although this document said that it could be used to override them. Now this function will reduce or
increase the limits.
-Starting in libpng-1.5.10, the user limits can be set en masse with the
-configuration option PNG_SAFE_LIMITS_SUPPORTED. If this option is enabled,
-a set of "safe" limits is applied in pngpriv.h. These can be overridden by
-application calls to png_set_user_limits(), png_set_user_chunk_cache_max(),
-and/or png_set_user_malloc_max() that increase or decrease the limits. Also,
-in libpng-1.5.10 the default width and height limits were increased
-from 1,000,000 to 0x7fffffff (i.e., made unlimited). Therefore, the
-limits are now
- default safe
+Starting in libpng-1.5.22, default user limits were established. These
+can be overridden by application calls to png_set_user_limits(),
+png_set_user_chunk_cache_max(), and/or png_set_user_malloc_max().
+The limits are now
+ max possible default
png_user_width_max 0x7fffffff 1,000,000
png_user_height_max 0x7fffffff 1,000,000
- png_user_chunk_cache_max 0 (unlimited) 128
+ png_user_chunk_cache_max 0 (unlimited) 1000
png_user_chunk_malloc_max 0 (unlimited) 8,000,000
The png_set_option() function (and the "options" member of the png struct) was
@@ -5688,6 +5730,11 @@ is an error. Previously this requirement of the PNG specification was not enforced, and the palette was always limited to 256 entries. An over-length
PLTE chunk found in an input PNG is silently truncated.
+Starting with libpng-1.6.31, the eXIf chunk is supported. Libpng does not
+attempt to decode the Exif profile; it simply returns a byte array
+containing the profile to the calling application which must do its own
+decoding.
+
.SH XIII. Detecting libpng
The png_get_io_ptr() function has been present since libpng-0.88, has never
@@ -5704,27 +5751,33 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files going back to version 0.70. You can access the git repository (read only)
at
- git://git.code.sf.net/p/libpng/code
+ https://github.com/glennrp/libpng or
+ https://git.code.sf.net/p/libpng/code.git
-or you can browse it with a web browser by selecting the "code" button at
+or you can browse it with a web browser at
- https://sourceforge.net/projects/libpng
+ https://github.com/glennrp/libpng or
+ https://sourceforge.net/p/libpng/code/ci/libpng16/tree/
Patches can be sent to glennrp at users.sourceforge.net or to
png-mng-implement at lists.sourceforge.net or you can upload them to
the libpng bug tracker at
- http://libpng.sourceforge.net
+ https://libpng.sourceforge.io/
+
+or as a "pull request" to
+
+ https://github.com/glennrp/libpng/pulls
We also accept patches built from the tar or zip distributions, and
simple verbal discriptions of bug fixes, reported either to the
SourceForge bug tracker, to the png-mng-implement at lists.sf.net
-mailing list, or directly to glennrp.
+mailing list, as github issues, or directly to glennrp.
.SH XV. Coding style
Our coding style is similar to the "Allman" style
-(See http://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly
+(See https://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly
braces on separate lines:
if (condition)
@@ -5825,7 +5878,7 @@ Prior to libpng-1.6.0 we used a "png_sizeof()" macro, formatted as though it were a function.
Control keywords if, for, while, and switch are always followed by a space
-to distinguish them from function calls, which have no trailing space.
+to distinguish them from function calls, which have no trailing space.
We put a space after each comma and after each semicolon
in "for" statements, and we put spaces before and after each
@@ -5851,7 +5904,7 @@ 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, and for pointers
-we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)".
+we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)".
We do not use the TAB character for indentation in the C sources.
@@ -5865,7 +5918,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.29 are Y2K compliant. It is my belief that earlier
+upward through 1.6.31 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
@@ -5967,7 +6020,7 @@ the first widely used release: ...
1.5.28 15 10528 15.so.15.28[.0]
...
- 1.6.29 16 10629 16.so.16.29[.0]
+ 1.6.31 16 10631 16.so.16.31[.0]
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
@@ -5984,7 +6037,7 @@ release number plus "betaNN" or "rcNN". .LP
.IR libpng :
.IP
-http://libpng.sourceforge.net (follow the [DOWNLOAD] link)
+https://libpng.sourceforge.io/ (follow the [DOWNLOAD] link)
http://www.libpng.org/pub/png
.LP
@@ -5994,7 +6047,7 @@ http://www.libpng.org/pub/png .I libpng
or at
.br
-ftp://ftp.info-zip.org/pub/infozip/zlib
+https://zlib.net/
.LP
.IR PNG specification: RFC 2083
@@ -6003,11 +6056,11 @@ ftp://ftp.info-zip.org/pub/infozip/zlib .I libpng
or at
.br
-ftp://ftp.rfc-editor.org:/in-notes/rfc2083.txt
+https://www.ietf.org/rfc/rfc2083.txt
.br
or (as a W3C Recommendation) at
.br
-http://www.w3.org/TR/REC-png.html
+https://www.w3.org/TR/REC-png.html
.LP
In the case of any inconsistency between the PNG specification
@@ -6023,7 +6076,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation.
-Libpng version 1.6.29 - March 16, 2017:
+Libpng version 1.6.31 - July 27, 2017:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@@ -6048,7 +6101,7 @@ this sentence. This code is released under the libpng license.
-libpng versions 1.0.7, July 1, 2000 through 1.6.29, March 16, 2017 are
+libpng versions 1.0.7, July 1, 2000 through 1.6.31, July 27, 2017 are
Copyright (c) 2000-2002, 2004, 2006-2017 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
@@ -6176,7 +6229,7 @@ files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-March 16, 2017
+July 27, 2017
.\" end of man page
diff --git a/plugins/AdvaImg/src/LibPNG/libpngpf.3 b/plugins/AdvaImg/src/LibPNG/libpngpf.3 index db0d9f2ad7..ade6d634a4 100644 --- a/plugins/AdvaImg/src/LibPNG/libpngpf.3 +++ b/plugins/AdvaImg/src/LibPNG/libpngpf.3 @@ -1,11 +1,11 @@ -.TH LIBPNGPF 3 "March 16, 2017"
+.TH LIBPNGPF 3 "April 1, 2017"
.SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.6.29
+libpng \- Portable Network Graphics (PNG) Reference Library 1.6.31
(private functions)
.SH SYNOPSIS
-\fB#include \fI"pngpriv.h"
+\fB\fB#include \fI\fI"pngpriv.h"
-\fBAs of libpng version \fP\fI1.5.1\fP\fB, this section is no longer \fP\fImaintained\fP\fB, now that the private function prototypes are hidden in pngpriv.h and not accessible to applications. Look in pngpriv.h for the prototypes and a short description of each \fIfunction.
+\fB\fBAs of libpng version \fP\fI\fP\fI1.5.1\fP\fB\fP\fB, this section is no longer \fP\fI\fP\fImaintained\fP\fB\fP\fB, now that the private function prototypes are hidden in pngpriv.h and not accessible to applications. Look in pngpriv.h for the prototypes and a short description of each \fI\fIfunction.
.SH DESCRIPTION
The functions previously listed here are used privately by libpng and are not
diff --git a/plugins/AdvaImg/src/LibPNG/png.5 b/plugins/AdvaImg/src/LibPNG/png.5 index fd4c69cbe8..fea3610bc7 100644 --- a/plugins/AdvaImg/src/LibPNG/png.5 +++ b/plugins/AdvaImg/src/LibPNG/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "March 16, 2017"
+.TH PNG 5 "April 1, 2017"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION
@@ -23,11 +23,11 @@ platforms. PNG specification (second edition), November 2003:
.IP
.br
- <http://www.w3.org/TR/2003/REC-PNG-20031110/
+ <https://www.w3.org/TR/2003/REC-PNG-20031110/
PNG 1.2 specification, July 1999:
.IP
.br
-http://png-mng.sourceforge.net/pub/png/spec/1.2/
+https://png-mng.sourceforge.io/pub/png/spec/1.2/
.LP
PNG 1.0 specification, October 1996:
.IP
@@ -35,11 +35,11 @@ PNG 1.0 specification, October 1996: RFC 2083
.IP
.br
-http://www.ietf.org/rfc/rfc2083.txt
+https://www.ietf.org/rfc/rfc2083.txt
.br
or (as a W3C Recommendation) at
.br
-http://www.w3.org/TR/REC-png-961001
+https://www.w3.org/TR/REC-png-961001
.SH AUTHORS
This man page: Glenn Randers-Pehrson
.LP
diff --git a/plugins/AdvaImg/src/LibPNG/png.c b/plugins/AdvaImg/src/LibPNG/png.c index c582316bdf..91fb654d04 100644 --- a/plugins/AdvaImg/src/LibPNG/png.c +++ b/plugins/AdvaImg/src/LibPNG/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions
*
- * Last changed in libpng 1.6.29 [March 16, 2017]
+ * Last changed in libpng 1.6.31 [July 27, 2017]
* Copyright (c) 1998-2002,2004,2006-2017 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,27 @@ #include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_29 Your_png_h_is_not_version_1_6_29;
+typedef png_libpng_version_1_6_31 Your_png_h_is_not_version_1_6_31;
+
+#ifdef __GNUC__
+/* The version tests may need to be added to, but the problem warning has
+ * consistently been fixed in GCC versions which obtain wide-spread release.
+ * The problem is that many versions of GCC rearrange comparison expressions in
+ * the optimizer in such a way that the results of the comparison will change
+ * if signed integer overflow occurs. Such comparisons are not permitted in
+ * ANSI C90, however GCC isn't clever enough to work out that that do not occur
+ * below in png_ascii_from_fp and png_muldiv, so it produces a warning with
+ * -Wextra. Unfortunately this is highly dependent on the optimizer and the
+ * machine architecture so the warning comes and goes unpredictably and is
+ * impossible to "fix", even were that a good idea.
+ */
+#if __GNUC__ == 7 && __GNUC_MINOR__ == 1
+#define GCC_STRICT_OVERFLOW 1
+#endif /* GNU 7.1.x */
+#endif /* GNU */
+#ifndef GCC_STRICT_OVERFLOW
+#define GCC_STRICT_OVERFLOW 0
+#endif
/* 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
@@ -595,6 +615,16 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, }
#endif
+#ifdef PNG_eXIf_SUPPORTED
+ /* Free any eXIf entry */
+ if (((mask & PNG_FREE_EXIF) & info_ptr->free_me) != 0)
+ {
+ png_free(png_ptr, info_ptr->exif);
+ info_ptr->exif = NULL;
+ info_ptr->valid &= ~PNG_INFO_eXIf;
+ }
+#endif
+
#ifdef PNG_hIST_SUPPORTED
/* Free any hIST entry */
if (((mask & PNG_FREE_HIST) & info_ptr->free_me) != 0)
@@ -776,14 +806,14 @@ png_get_copyright(png_const_structrp png_ptr) #else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
- "libpng version 1.6.29 - March 16, 2017" PNG_STRING_NEWLINE \
+ "libpng version 1.6.31 - July 27, 2017" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# else
- return "libpng version 1.6.29 - March 16, 2017\
+ return "libpng version 1.6.31 - July 27, 2017\
Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@@ -2832,7 +2862,7 @@ png_pow10(int power) if (power < 0)
{
if (power < DBL_MIN_10_EXP) return 0;
- recip = 1, power = -power;
+ recip = 1; power = -power;
}
if (power > 0)
@@ -2857,6 +2887,14 @@ png_pow10(int power) /* Function to format a floating point value in ASCII with a given
* precision.
*/
+#if GCC_STRICT_OVERFLOW
+#pragma GCC diagnostic push
+/* The problem arises below with exp_b10, which can never overflow because it
+ * comes, originally, from frexp and is therefore limited to a range which is
+ * typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)).
+ */
+#pragma GCC diagnostic warning "-Wstrict-overflow=2"
+#endif /* GCC_STRICT_OVERFLOW */
void /* PRIVATE */
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
double fp, unsigned int precision)
@@ -2910,7 +2948,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, double test = png_pow10(exp_b10+1);
if (test <= DBL_MAX)
- ++exp_b10, base = test;
+ {
+ ++exp_b10; base = test;
+ }
else
break;
@@ -2924,7 +2964,10 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, * test on DBL_MAX above.
*/
fp /= base;
- while (fp >= 1) fp /= 10, ++exp_b10;
+ while (fp >= 1)
+ {
+ fp /= 10; ++exp_b10;
+ }
/* Because of the code above fp may, at this point, be
* less than .1, this is ok because the code below can
@@ -2941,7 +2984,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 = (unsigned int)(-exp_b10); /* PLUS 2 digits: TOTAL 3 */
+ czero = 0U-exp_b10; /* PLUS 2 digits: TOTAL 3 */
exp_b10 = 0; /* Dot added below before first output. */
}
else
@@ -2975,7 +3018,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Rounding up to 10, handle that here. */
if (czero > 0)
{
- --czero, d = 1;
+ --czero; d = 1;
if (cdigits == 0) --clead;
}
else
@@ -2989,7 +3032,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, else if (ch == 46)
{
- ch = *--ascii, ++size;
+ ch = *--ascii; ++size;
/* Advance exp_b10 to '1', so that the
* decimal point happens after the
* previous digit.
@@ -3016,7 +3059,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, int ch = *--ascii;
if (ch == 46)
- ++size, exp_b10 = 1;
+ {
+ ++size; exp_b10 = 1;
+ }
/* Else lost a leading zero, so 'exp_b10' is
* still ok at (-1)
@@ -3052,21 +3097,26 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, */
if (exp_b10 != (-1))
{
- if (exp_b10 == 0) *ascii++ = 46, --size;
+ if (exp_b10 == 0)
+ {
+ *ascii++ = 46; --size;
+ }
/* PLUS 1: TOTAL 4 */
--exp_b10;
}
- *ascii++ = 48, --czero;
+ *ascii++ = 48; --czero;
}
if (exp_b10 != (-1))
{
if (exp_b10 == 0)
- *ascii++ = 46, --size; /* counted above */
+ {
+ *ascii++ = 46; --size; /* counted above */
+ }
--exp_b10;
}
- *ascii++ = (char)(48 + (int)d), ++cdigits;
+ *ascii++ = (char)(48 + (int)d); ++cdigits;
}
}
while (cdigits+czero < precision+clead && fp > DBL_MIN);
@@ -3075,7 +3125,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Check for an exponent, if we don't need one we are
* done and just need to terminate the string. At
- * this point exp_b10==(-1) is effectively if flag - it got
+ * this point exp_b10==(-1) is effectively a flag - it got
* to '-1' because of the decrement after outputting
* the decimal point above (the exponent required is
* *not* -1!)
@@ -3089,7 +3139,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, * zeros were *not* output, so this doesn't increase
* the output count.
*/
- while (--exp_b10 >= 0) *ascii++ = 48;
+ while (exp_b10-- > 0) *ascii++ = 48;
*ascii = 0;
@@ -3107,7 +3157,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, */
size -= cdigits;
- *ascii++ = 69, --size; /* 'E': PLUS 1 TOTAL 2+precision */
+ *ascii++ = 69; --size; /* 'E': PLUS 1 TOTAL 2+precision */
/* The following use of an unsigned temporary avoids ambiguities in
* the signed arithmetic on exp_b10 and permits GCC at least to do
@@ -3118,12 +3168,12 @@ 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 = (unsigned int)(-exp_b10);
+ *ascii++ = 45; --size; /* '-': PLUS 1 TOTAL 3+precision */
+ uexp_b10 = 0U-exp_b10;
}
else
- uexp_b10 = (unsigned int)exp_b10;
+ uexp_b10 = 0U+exp_b10;
cdigits = 0;
@@ -3166,6 +3216,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Here on buffer too small. */
png_error(png_ptr, "ASCII conversion buffer too small");
}
+#if GCC_STRICT_OVERFLOW
+#pragma GCC diagnostic pop
+#endif /* GCC_STRICT_OVERFLOW */
# endif /* FLOATING_POINT */
@@ -3185,7 +3238,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 = (png_uint_32)(-fp);
+ {
+ *ascii++ = 45; num = (png_uint_32)(-fp);
+ }
else
num = (png_uint_32)fp;
@@ -3223,7 +3278,10 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii, * then ndigits digits to first:
*/
i = 5;
- while (ndigits < i) *ascii++ = 48, --i;
+ while (ndigits < i)
+ {
+ *ascii++ = 48; --i;
+ }
while (ndigits >= first) *ascii++ = digits[--ndigits];
/* Don't output the trailing zeros! */
}
@@ -3274,6 +3332,15 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text) * the nearest .00001). Overflow and divide by zero are signalled in
* the result, a boolean - true on success, false on overflow.
*/
+#if GCC_STRICT_OVERFLOW /* from above */
+/* It is not obvious which comparison below gets optimized in such a way that
+ * signed overflow would change the result; looking through the code does not
+ * reveal any tests which have the form GCC complains about, so presumably the
+ * optimizer is moving an add or subtract into the 'if' somewhere.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic warning "-Wstrict-overflow=2"
+#endif /* GCC_STRICT_OVERFLOW */
int
png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
png_int_32 divisor)
@@ -3388,6 +3455,9 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times, return 0;
}
+#if GCC_STRICT_OVERFLOW
+#pragma GCC diagnostic pop
+#endif /* GCC_STRICT_OVERFLOW */
#endif /* READ_GAMMA || INCH_CONVERSIONS */
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
@@ -4278,7 +4348,7 @@ png_set_option(png_structrp png_ptr, int option, int onoff) defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
/* sRGB conversion tables; these are machine generated with the code in
* contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the
- * specification (see the article at http://en.wikipedia.org/wiki/SRGB)
+ * specification (see the article at https://en.wikipedia.org/wiki/SRGB)
* is used, not the gamma=1/2.2 approximation use elsewhere in libpng.
* The sRGB to linear table is exact (to the nearest 16-bit linear fraction).
* The inverse (linear to sRGB) table has accuracies as follows:
diff --git a/plugins/AdvaImg/src/LibPNG/png.h b/plugins/AdvaImg/src/LibPNG/png.h index 3e3ada3022..4572030c18 100644 --- a/plugins/AdvaImg/src/LibPNG/png.h +++ b/plugins/AdvaImg/src/LibPNG/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library
*
- * libpng version 1.6.29, March 16, 2017
+ * libpng version 1.6.31, July 27, 2017
*
* Copyright (c) 1998-2002,2004,2006-2017 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.29, March 16, 2017:
+ * libpng versions 0.97, January 1998, through 1.6.31, July 27, 2017:
* Glenn Randers-Pehrson.
* See also "Contributing Authors", below.
*/
@@ -25,7 +25,7 @@ *
* This code is released under the libpng license.
*
- * libpng versions 1.0.7, July 1, 2000 through 1.6.29, March 16, 2017 are
+ * libpng versions 1.0.7, July 1, 2000 through 1.6.31, July 27, 2017 are
* Copyright (c) 2000-2002, 2004, 2006-2017 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
@@ -213,7 +213,7 @@ * ...
* 1.5.28 15 10527 15.so.15.28[.0]
* ...
- * 1.6.29 16 10629 16.so.16.29[.0]
+ * 1.6.31 16 10631 16.so.16.31[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -234,20 +234,20 @@ *
* See libpng.txt or libpng.3 for more information. The PNG specification
* is available as a W3C Recommendation and as an ISO Specification,
- * <http://www.w3.org/TR/2003/REC-PNG-20031110/
+ * <https://www.w3.org/TR/2003/REC-PNG-20031110/
*/
/*
* Y2K compliance in libpng:
* =========================
*
- * March 16, 2017
+ * July 27, 2017
*
* 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.29 are Y2K compliant. It is my belief that
+ * upward through 1.6.31 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
@@ -309,8 +309,8 @@ */
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.29"
-#define PNG_HEADER_VERSION_STRING " libpng version 1.6.29 - March 16, 2017\n"
+#define PNG_LIBPNG_VER_STRING "1.6.31"
+#define PNG_HEADER_VERSION_STRING " libpng version 1.6.31 - July 27, 2017\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
@@ -318,7 +318,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 29
+#define PNG_LIBPNG_VER_RELEASE 31
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
@@ -349,7 +349,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 10629 /* 1.6.29 */
+#define PNG_LIBPNG_VER 10631 /* 1.6.31 */
/* Library configuration: these options cannot be changed after
* the library has been built.
@@ -459,7 +459,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_29;
+typedef char* png_libpng_version_1_6_31;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
*
@@ -776,6 +776,7 @@ typedef png_unknown_chunk * * png_unknown_chunkpp; #define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */
#define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
#define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
+#define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
/* This is used for the transformation routines, as some of them
* change these values for the row. It also should enable using
@@ -1788,7 +1789,8 @@ PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr, #define PNG_FREE_PLTE 0x1000U
#define PNG_FREE_TRNS 0x2000U
#define PNG_FREE_TEXT 0x4000U
-#define PNG_FREE_ALL 0x7fffU
+#define PNG_FREE_EXIF 0x8000U /* Added at libpng-1.6.31 */
+#define PNG_FREE_ALL 0xffffU
#define PNG_FREE_MUL 0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
#ifdef PNG_USER_MEM_SUPPORTED
@@ -2007,6 +2009,13 @@ PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr, png_fixed_point int_blue_Z))
#endif
+#ifdef PNG_eXIf_SUPPORTED
+PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr,
+ png_inforp info_ptr, png_bytep *exif));
+PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr,
+ png_inforp info_ptr, const png_bytep exif));
+#endif
+
#ifdef PNG_gAMA_SUPPORTED
PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr,
png_const_inforp info_ptr, double *file_gamma))
@@ -2025,9 +2034,6 @@ PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr, #ifdef PNG_hIST_SUPPORTED
PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr,
png_inforp info_ptr, png_uint_16p *hist));
-#endif
-
-#ifdef PNG_hIST_SUPPORTED
PNG_EXPORT(142, void, png_set_hIST, (png_const_structrp png_ptr,
png_inforp info_ptr, png_const_uint_16p hist));
#endif
@@ -2753,7 +2759,7 @@ typedef struct *
* When the simplified API needs to convert between sRGB and linear colorspaces,
* the actual sRGB transfer curve defined in the sRGB specification (see the
- * article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
+ * article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
* approximation used elsewhere in libpng.
*
* When an alpha channel is present it is expected to denote pixel coverage
@@ -3253,7 +3259,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option, * one to use is one more than this.)
*/
#ifdef PNG_EXPORT_LAST_ORDINAL
- PNG_EXPORT_LAST_ORDINAL(245);
+ PNG_EXPORT_LAST_ORDINAL(247);
#endif
#ifdef __cplusplus
diff --git a/plugins/AdvaImg/src/LibPNG/pngconf.h b/plugins/AdvaImg/src/LibPNG/pngconf.h index 3fd29eb246..7c726ee149 100644 --- a/plugins/AdvaImg/src/LibPNG/pngconf.h +++ b/plugins/AdvaImg/src/LibPNG/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.6.29, March 16, 2017
+ * libpng version 1.6.31, July 27, 2017
*
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/plugins/AdvaImg/src/LibPNG/pngerror.c b/plugins/AdvaImg/src/LibPNG/pngerror.c index d6f22ef619..bf6edd6db0 100644 --- a/plugins/AdvaImg/src/LibPNG/pngerror.c +++ b/plugins/AdvaImg/src/LibPNG/pngerror.c @@ -1,8 +1,8 @@ /* pngerror.c - stub functions for i/o and memory allocation
*
- * Last changed in libpng 1.6.26 [October 20, 2016]
- * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.31 [July 27, 2017]
+ * Copyright (c) 1998-2002,2004,2006-2017 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.)
*
@@ -163,7 +163,7 @@ png_format_number(png_const_charp start, png_charp end, int format, case PNG_NUMBER_FORMAT_02u:
/* Expects at least 2 digits. */
mincount = 2;
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case PNG_NUMBER_FORMAT_u:
*--end = digits[number % 10];
@@ -173,7 +173,7 @@ png_format_number(png_const_charp start, png_charp end, int format, case PNG_NUMBER_FORMAT_02x:
/* This format expects at least two digits */
mincount = 2;
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case PNG_NUMBER_FORMAT_x:
*--end = digits[number & 0xf];
diff --git a/plugins/AdvaImg/src/LibPNG/pngget.c b/plugins/AdvaImg/src/LibPNG/pngget.c index b218261270..2779548336 100644 --- a/plugins/AdvaImg/src/LibPNG/pngget.c +++ b/plugins/AdvaImg/src/LibPNG/pngget.c @@ -773,6 +773,24 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr, }
#endif
+#ifdef PNG_eXIf_SUPPORTED
+png_uint_32 PNGAPI
+png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_bytep *exif)
+{
+ png_debug1(1, "in %s retrieval function", "eXIf");
+
+ if (png_ptr != NULL && info_ptr != NULL &&
+ (info_ptr->valid & PNG_INFO_eXIf) != 0 && exif != NULL)
+ {
+ *exif = info_ptr->exif;
+ return (PNG_INFO_eXIf);
+ }
+
+ return (0);
+}
+#endif
+
#ifdef PNG_hIST_SUPPORTED
png_uint_32 PNGAPI
png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
diff --git a/plugins/AdvaImg/src/LibPNG/pnginfo.h b/plugins/AdvaImg/src/LibPNG/pnginfo.h index 036f58c258..61f4272267 100644 --- a/plugins/AdvaImg/src/LibPNG/pnginfo.h +++ b/plugins/AdvaImg/src/LibPNG/pnginfo.h @@ -185,6 +185,11 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
#endif
+#ifdef PNG_eXIf_SUPPORTED
+ int num_exif;
+ png_bytep exif;
+#endif
+
#ifdef PNG_hIST_SUPPORTED
/* The hIST chunk contains the relative frequency or importance of the
* various palette entries, so that a viewer can intelligently select a
diff --git a/plugins/AdvaImg/src/LibPNG/pngpriv.h b/plugins/AdvaImg/src/LibPNG/pngpriv.h index 3ead806b04..8599652916 100644 --- a/plugins/AdvaImg/src/LibPNG/pngpriv.h +++ b/plugins/AdvaImg/src/LibPNG/pngpriv.h @@ -1,7 +1,7 @@ /* pngpriv.h - private declarations for use inside libpng
*
- * Last changed in libpng 1.6.29 [March 16, 2017]
+ * Last changed in libpng 1.6.31 [July 27, 2017]
* Copyright (c) 1998-2002,2004,2006-2017 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.)
@@ -35,7 +35,9 @@ * Windows/Visual Studio) there is no effect; the OS specific tests below are
* still required (as of 2011-05-02.)
*/
-#define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
+#ifndef _POSIX_SOURCE
+# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
+#endif
#ifndef PNG_VERSION_INFO_ONLY
/* Standard library headers not required by png.h: */
@@ -452,6 +454,21 @@ # define png_fixed_error(s1,s2) png_err(s1)
#endif
+/* Some fixed point APIs are still required even if not exported because
+ * they get used by the corresponding floating point APIs. This magic
+ * deals with this:
+ */
+#ifdef PNG_FIXED_POINT_SUPPORTED
+# define PNGFAPI PNGAPI
+#else
+# define PNGFAPI /* PRIVATE */
+#endif
+
+#ifndef PNG_VERSION_INFO_ONLY
+/* Other defines specific to compilers can go here. Try to keep
+ * them inside an appropriate ifdef/endif pair for portability.
+ */
+
/* C allows up-casts from (void*) to any pointer and (const void*) to any
* pointer to a const object. C++ regards this as a type error and requires an
* explicit, static, cast and provides the static_cast<> rune to ensure that
@@ -466,25 +483,20 @@ static_cast<type>(static_cast<const void*>(value))
#else
# define png_voidcast(type, value) (value)
-# define png_constcast(type, value) ((type)(value))
+# ifdef _WIN64
+# ifdef __GNUC__
+ typedef unsigned long long png_ptruint;
+# else
+ typedef unsigned __int64 png_ptruint;
+# endif
+# else
+ typedef unsigned long png_ptruint;
+# endif
+# define png_constcast(type, value) ((type)(png_ptruint)(const void*)(value))
# define png_aligncast(type, value) ((void*)(value))
# define png_aligncastconst(type, value) ((const void*)(value))
#endif /* __cplusplus */
-/* Some fixed point APIs are still required even if not exported because
- * they get used by the corresponding floating point APIs. This magic
- * deals with this:
- */
-#ifdef PNG_FIXED_POINT_SUPPORTED
-# define PNGFAPI PNGAPI
-#else
-# define PNGFAPI /* PRIVATE */
-#endif
-
-#ifndef PNG_VERSION_INFO_ONLY
-/* Other defines specific to compilers can go here. Try to keep
- * them inside an appropriate ifdef/endif pair for portability.
- */
#if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
/* png.c requires the following ANSI-C constants if the conversion of
@@ -830,6 +842,7 @@ #define png_PLTE PNG_U32( 80, 76, 84, 69)
#define png_bKGD PNG_U32( 98, 75, 71, 68)
#define png_cHRM PNG_U32( 99, 72, 82, 77)
+#define png_eXIf PNG_U32(101, 88, 73, 102) /* registered July 2017 */
#define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
#define png_gAMA PNG_U32(103, 65, 77, 65)
#define png_gIFg PNG_U32(103, 73, 70, 103)
@@ -1429,6 +1442,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
#endif
+#ifdef PNG_READ_eXIf_SUPPORTED
+PNG_INTERNAL_FUNCTION(void,png_handle_eXIf,(png_structrp png_ptr,
+ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+#endif
+
#ifdef PNG_READ_gAMA_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
diff --git a/plugins/AdvaImg/src/LibPNG/pngread.c b/plugins/AdvaImg/src/LibPNG/pngread.c index c1f8c15cca..8d7cf76c24 100644 --- a/plugins/AdvaImg/src/LibPNG/pngread.c +++ b/plugins/AdvaImg/src/LibPNG/pngread.c @@ -1,8 +1,8 @@ /* pngread.c - read a PNG file
*
- * Last changed in libpng 1.6.26 [October 20, 2016]
- * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.31 [July 27, 2017]
+ * Copyright (c) 1998-2002,2004,2006-2017 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.)
*
@@ -1883,7 +1883,7 @@ png_create_colormap_entry(png_image_read_control *display, {
case 4:
entry[afirst ? 0 : 3] = (png_uint_16)alpha;
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case 3:
if (alpha < 65535)
@@ -1905,7 +1905,7 @@ png_create_colormap_entry(png_image_read_control *display, case 2:
entry[1 ^ afirst] = (png_uint_16)alpha;
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case 1:
if (alpha < 65535)
@@ -1934,6 +1934,7 @@ png_create_colormap_entry(png_image_read_control *display, {
case 4:
entry[afirst ? 0 : 3] = (png_byte)alpha;
+ /* FALLTHROUGH */
case 3:
entry[afirst + (2 ^ bgr)] = (png_byte)blue;
entry[afirst + 1] = (png_byte)green;
@@ -1942,6 +1943,7 @@ png_create_colormap_entry(png_image_read_control *display, case 2:
entry[1 ^ afirst] = (png_byte)alpha;
+ /* FALLTHROUGH */
case 1:
entry[afirst] = (png_byte)green;
break;
@@ -2861,7 +2863,7 @@ png_image_read_colormap(png_voidp argument) case P_sRGB:
/* Change to 8-bit sRGB */
png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB);
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case P_FILE:
if (png_ptr->bit_depth > 8)
@@ -3179,8 +3181,7 @@ png_image_read_colormapped(png_voidp argument) image->colormap_entries == 244 /* 216 + 1 + 27 */)
break;
- /* goto bad_output; */
- /* FALL THROUGH */
+ goto bad_output;
default:
bad_output:
diff --git a/plugins/AdvaImg/src/LibPNG/pngrtran.c b/plugins/AdvaImg/src/LibPNG/pngrtran.c index 4d3f8fa298..9679ba35df 100644 --- a/plugins/AdvaImg/src/LibPNG/pngrtran.c +++ b/plugins/AdvaImg/src/LibPNG/pngrtran.c @@ -1,7 +1,7 @@ /* pngrtran.c - transforms the data in a row for PNG readers
*
- * Last changed in libpng 1.6.29 [March 16, 2017]
+ * Last changed in libpng 1.6.31 [July 27, 2017]
* Copyright (c) 1998-2002,2004,2006-2017 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.)
@@ -49,6 +49,7 @@ png_set_crc_action(png_structrp png_ptr, int crit_action, int ancil_action) case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */
png_warning(png_ptr,
"Can't discard critical data on CRC error");
+ /* FALLTHROUGH */
case PNG_CRC_ERROR_QUIT: /* Error/quit */
case PNG_CRC_DEFAULT:
@@ -1253,7 +1254,7 @@ png_init_rgb_transformations(png_structrp png_ptr) default:
case 8:
- /* FALL THROUGH (Already 8 bits) */
+ /* FALLTHROUGH */ /* (Already 8 bits) */
case 16:
/* Already a full 16 bits */
@@ -2934,7 +2935,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) * using the equation given in Poynton's ColorFAQ of 1998-01-04 at
* <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008 but
* versions dated 1998 through November 2002 have been archived at
- * http://web.archive.org/web/20000816232553/http://www.inforamp.net/
+ * https://web.archive.org/web/20000816232553/www.inforamp.net/
* ~poynton/notes/colour_and_gamma/ColorFAQ.txt )
* Charles Poynton poynton at poynton.com
*
@@ -4601,7 +4602,9 @@ png_do_expand_16(png_row_infop row_info, png_bytep row) png_byte *sp = row + row_info->rowbytes; /* source, last byte + 1 */
png_byte *dp = sp + row_info->rowbytes; /* destination, end + 1 */
while (dp > sp)
- dp[-2] = dp[-1] = *--sp, dp -= 2;
+ {
+ dp[-2] = dp[-1] = *--sp; dp -= 2;
+ }
row_info->rowbytes *= 2;
row_info->bit_depth = 16;
diff --git a/plugins/AdvaImg/src/LibPNG/pngrutil.c b/plugins/AdvaImg/src/LibPNG/pngrutil.c index e377b3250f..afcebe40cb 100644 --- a/plugins/AdvaImg/src/LibPNG/pngrutil.c +++ b/plugins/AdvaImg/src/LibPNG/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file
*
- * Last changed in libpng 1.6.29 [March 16, 2017]
+ * Last changed in libpng 1.6.31 [July 27, 2017]
* Copyright (c) 1998-2002,2004,2006-2017 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.)
@@ -2009,6 +2009,44 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) }
#endif
+#ifdef PNG_READ_eXIf_SUPPORTED
+void /* PRIVATE */
+png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+{
+ unsigned int i;
+ png_bytep eXIf_buf;
+
+ png_debug(1, "in png_handle_eXIf");
+
+ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
+ png_chunk_error(png_ptr, "missing IHDR");
+
+ else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_eXIf) != 0)
+ {
+ png_crc_finish(png_ptr, length);
+ png_chunk_benign_error(png_ptr, "duplicate");
+ return;
+ }
+
+ eXIf_buf = png_voidcast(png_bytep,
+ png_malloc_warn(png_ptr, length));
+
+ for (i = 0; i < length; i++)
+ {
+ png_byte buf[1];
+ png_crc_read(png_ptr, buf, 1);
+ eXIf_buf[i] = buf[0];
+ }
+
+ if (png_crc_finish(png_ptr, 0) != 0)
+ return;
+
+ info_ptr->num_exif = length;
+
+ png_set_eXIf(png_ptr, info_ptr, eXIf_buf);
+}
+#endif
+
#ifdef PNG_READ_hIST_SUPPORTED
void /* PRIVATE */
png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
@@ -2537,6 +2575,9 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
png_ptr->mode |= PNG_AFTER_IDAT;
+ /* Note, "length" is sufficient here; we won't be adding
+ * a null terminator later.
+ */
buffer = png_read_buffer(png_ptr, length, 2/*silent*/);
if (buffer == NULL)
@@ -2975,7 +3016,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, case 2:
png_ptr->user_chunk_cache_max = 1;
png_chunk_benign_error(png_ptr, "no space in chunk cache");
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case 1:
/* NOTE: prior to 1.6.0 this case resulted in an unknown critical
* chunk being skipped, now there will be a hard error below.
@@ -2984,7 +3025,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, default: /* not at limit */
--(png_ptr->user_chunk_cache_max);
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case 0: /* no limit */
# endif /* USER_LIMITS */
/* Here when the limit isn't reached or when limits are compiled
@@ -3377,7 +3418,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) */
do
{
- dp[0] = sp[0], dp[1] = sp[1];
+ dp[0] = sp[0]; dp[1] = sp[1];
if (row_width <= bytes_to_jump)
return;
@@ -3398,7 +3439,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) */
for (;;)
{
- dp[0] = sp[0], dp[1] = sp[1], dp[2] = sp[2];
+ dp[0] = sp[0]; dp[1] = sp[1]; dp[2] = sp[2];
if (row_width <= bytes_to_jump)
return;
@@ -3887,7 +3928,10 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row, /* Find the best predictor, the least of pa, pb, pc favoring the earlier
* ones in the case of a tie.
*/
- if (pb < pa) pa = pb, a = b;
+ if (pb < pa)
+ {
+ pa = pb; a = b;
+ }
if (pc < pa) a = c;
/* Calculate the current pixel in a, and move the previous row pixel to c
@@ -3939,7 +3983,10 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row, pc = (p + pc) < 0 ? -(p + pc) : p + pc;
#endif
- if (pb < pa) pa = pb, a = b;
+ if (pb < pa)
+ {
+ pa = pb; a = b;
+ }
if (pc < pa) a = c;
a += *row;
diff --git a/plugins/AdvaImg/src/LibPNG/pngset.c b/plugins/AdvaImg/src/LibPNG/pngset.c index 843d302825..7c6ed11a44 100644 --- a/plugins/AdvaImg/src/LibPNG/pngset.c +++ b/plugins/AdvaImg/src/LibPNG/pngset.c @@ -1,8 +1,8 @@ /* pngset.c - storage of image information into info struct
*
- * Last changed in libpng 1.6.26 [October 20, 2016]
- * Copyright (c) 1998-2016 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.30 [June 28, 2017]
+ * Copyright (c) 1998-2017 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.)
*
@@ -134,6 +134,39 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X, #endif /* cHRM */
+#ifdef PNG_eXIf_SUPPORTED
+void PNGAPI
+png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
+ const png_bytep eXIf_buf)
+{
+ int i;
+
+ png_debug1(1, "in %s storage function", "eXIf");
+
+ if (png_ptr == NULL || info_ptr == NULL)
+ return;
+
+ png_free_data(png_ptr, info_ptr, PNG_FREE_EXIF, 0);
+
+ info_ptr->exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr,
+ info_ptr->num_exif));
+
+ if (info_ptr->exif == NULL)
+ {
+ png_warning(png_ptr, "Insufficient memory for eXIf chunk data");
+
+ return;
+ }
+
+ info_ptr->free_me |= PNG_FREE_EXIF;
+
+ for (i = 0; i < info_ptr->num_exif; i++)
+ info_ptr->exif[i] = eXIf_buf[i];
+
+ info_ptr->valid |= PNG_INFO_eXIf;
+}
+#endif /* eXIf */
+
#ifdef PNG_gAMA_SUPPORTED
void PNGFAPI
png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
@@ -1102,8 +1135,9 @@ png_set_sPLT(png_const_structrp png_ptr, info_ptr->valid |= PNG_INFO_sPLT;
++(info_ptr->splt_palettes_num);
++np;
+ ++entries;
}
- while (++entries, --nentries);
+ while (--nentries);
if (nentries > 0)
png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
@@ -1696,14 +1730,16 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key) png_byte ch = (png_byte)*key++;
if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
- *new_key++ = ch, ++key_len, space = 0;
+ {
+ *new_key++ = ch; ++key_len; space = 0;
+ }
else if (space == 0)
{
/* A space or an invalid character when one wasn't seen immediately
* before; output just a space.
*/
- *new_key++ = 32, ++key_len, space = 1;
+ *new_key++ = 32; ++key_len; space = 1;
/* If the character was not a space then it is invalid. */
if (ch != 32)
@@ -1716,7 +1752,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key) if (key_len > 0 && space != 0) /* trailing space */
{
- --key_len, --new_key;
+ --key_len; --new_key;
if (bad_character == 0)
bad_character = 32;
}
diff --git a/plugins/AdvaImg/src/LibPNG/pngstruct.h b/plugins/AdvaImg/src/LibPNG/pngstruct.h index d8cc70071f..e775080cc4 100644 --- a/plugins/AdvaImg/src/LibPNG/pngstruct.h +++ b/plugins/AdvaImg/src/LibPNG/pngstruct.h @@ -479,5 +479,8 @@ struct png_struct_def png_colorspace colorspace;
#endif
#endif
+
+/* New member added in libpng-1.6.31 */
+ int num_exif;
};
#endif /* PNGSTRUCT_H */
diff --git a/plugins/AdvaImg/src/LibPNG/pngtest.c b/plugins/AdvaImg/src/LibPNG/pngtest.c index b69a3dae05..feef2e3569 100644 --- a/plugins/AdvaImg/src/LibPNG/pngtest.c +++ b/plugins/AdvaImg/src/LibPNG/pngtest.c @@ -1192,6 +1192,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) }
}
#endif
+#ifdef PNG_eXIf_SUPPORTED
+ {
+ png_bytep exif;
+
+ if (png_get_eXIf(read_ptr, read_info_ptr, &exif) != 0)
+ png_set_eXIf(write_ptr, write_info_ptr, exif);
+ }
+#endif
#ifdef PNG_hIST_SUPPORTED
{
png_uint_16p hist;
@@ -1530,6 +1538,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) }
}
#endif
+#ifdef PNG_eXIf_SUPPORTED
+ {
+ png_bytep exif;
+
+ if (png_get_eXIf(read_ptr, end_info_ptr, &exif) != 0)
+ png_set_eXIf(write_ptr, write_end_info_ptr, exif);
+ }
+#endif
#ifdef PNG_tIME_SUPPORTED
{
png_timep mod_time;
@@ -2088,4 +2104,4 @@ main(void) #endif
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_29 Your_png_h_is_not_version_1_6_29;
+typedef png_libpng_version_1_6_31 Your_png_h_is_not_version_1_6_31;
diff --git a/plugins/AdvaImg/src/LibPNG/pngtrans.c b/plugins/AdvaImg/src/LibPNG/pngtrans.c index ed6cb60a8e..06c3a1c141 100644 --- a/plugins/AdvaImg/src/LibPNG/pngtrans.c +++ b/plugins/AdvaImg/src/LibPNG/pngtrans.c @@ -1,8 +1,8 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
- * Last changed in libpng 1.6.26 [October 20, 2016]
- * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.30 [June 28, 2017]
+ * Copyright (c) 1998-2002,2004,2006-2017 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.)
*
@@ -514,11 +514,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) if (at_start != 0) /* Skip initial filler */
++sp;
else /* Skip initial channel and, for sp, the filler */
- sp += 2, ++dp;
+ {
+ sp += 2; ++dp;
+ }
/* For a 1 pixel wide image there is nothing to do */
while (sp < ep)
- *dp++ = *sp, sp += 2;
+ {
+ *dp++ = *sp; sp += 2;
+ }
row_info->pixel_depth = 8;
}
@@ -528,10 +532,14 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) if (at_start != 0) /* Skip initial filler */
sp += 2;
else /* Skip initial channel and, for sp, the filler */
- sp += 4, dp += 2;
+ {
+ sp += 4; dp += 2;
+ }
while (sp < ep)
- *dp++ = *sp++, *dp++ = *sp, sp += 3;
+ {
+ *dp++ = *sp++; *dp++ = *sp; sp += 3;
+ }
row_info->pixel_depth = 16;
}
@@ -554,11 +562,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) if (at_start != 0) /* Skip initial filler */
++sp;
else /* Skip initial channels and, for sp, the filler */
- sp += 4, dp += 3;
+ {
+ sp += 4; dp += 3;
+ }
/* Note that the loop adds 3 to dp and 4 to sp each time. */
while (sp < ep)
- *dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2;
+ {
+ *dp++ = *sp++; *dp++ = *sp++; *dp++ = *sp; sp += 2;
+ }
row_info->pixel_depth = 24;
}
@@ -568,14 +580,16 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) if (at_start != 0) /* Skip initial filler */
sp += 2;
else /* Skip initial channels and, for sp, the filler */
- sp += 8, dp += 6;
+ {
+ sp += 8; dp += 6;
+ }
while (sp < ep)
{
/* Copy 6 bytes, skip 2 */
- *dp++ = *sp++, *dp++ = *sp++;
- *dp++ = *sp++, *dp++ = *sp++;
- *dp++ = *sp++, *dp++ = *sp, sp += 3;
+ *dp++ = *sp++; *dp++ = *sp++;
+ *dp++ = *sp++; *dp++ = *sp++;
+ *dp++ = *sp++; *dp++ = *sp; sp += 3;
}
row_info->pixel_depth = 48;
diff --git a/plugins/AdvaImg/src/LibPNG/pngwrite.c b/plugins/AdvaImg/src/LibPNG/pngwrite.c index 7967bb29b7..c4a328fdf2 100644 --- a/plugins/AdvaImg/src/LibPNG/pngwrite.c +++ b/plugins/AdvaImg/src/LibPNG/pngwrite.c @@ -1,8 +1,8 @@ /* pngwrite.c - general routines to write a PNG file
*
- * Last changed in libpng 1.6.26 [October 20, 2016]
- * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.31 [July 27, 2017]
+ * Copyright (c) 1998-2002,2004,2006-2017 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.)
*
@@ -1007,8 +1007,8 @@ png_set_filter(png_structrp png_ptr, int method, int filters) case 5:
case 6:
case 7: png_app_error(png_ptr, "Unknown row filter for method 0");
- /* FALL THROUGH */
#endif /* WRITE_FILTER */
+ /* FALLTHROUGH */
case PNG_FILTER_VALUE_NONE:
png_ptr->do_filter = PNG_FILTER_NONE; break;
@@ -1875,7 +1875,7 @@ png_image_set_PLTE(png_image_write_control *display) tRNS[i] = entry[afirst ? 0 : 3];
if (tRNS[i] < 255)
num_trans = i+1;
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case 3:
palette[i].blue = entry[afirst + (2 ^ bgr)];
palette[i].green = entry[afirst + 1];
@@ -1886,7 +1886,7 @@ png_image_set_PLTE(png_image_write_control *display) tRNS[i] = entry[1 ^ afirst];
if (tRNS[i] < 255)
num_trans = i+1;
- /* FALL THROUGH */
+ /* FALLTHROUGH */
case 1:
palette[i].blue = palette[i].red = palette[i].green =
entry[afirst];
diff --git a/plugins/AdvaImg/src/LibPNG/pngwutil.c b/plugins/AdvaImg/src/LibPNG/pngwutil.c index 21f489b347..7a09b35e8c 100644 --- a/plugins/AdvaImg/src/LibPNG/pngwutil.c +++ b/plugins/AdvaImg/src/LibPNG/pngwutil.c @@ -1003,7 +1003,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, optimize_cmf(data, png_image_size(png_ptr));
#endif
- png_write_complete_chunk(png_ptr, png_IDAT, data, size);
+ if (size > 0)
+ png_write_complete_chunk(png_ptr, png_IDAT, data, size);
png_ptr->mode |= PNG_HAVE_IDAT;
png_ptr->zstream.next_out = data;
@@ -1049,7 +1050,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, optimize_cmf(data, png_image_size(png_ptr));
#endif
- png_write_complete_chunk(png_ptr, png_IDAT, data, size);
+ if (size > 0)
+ png_write_complete_chunk(png_ptr, png_IDAT, data, size);
png_ptr->zstream.avail_out = 0;
png_ptr->zstream.next_out = NULL;
png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT;
@@ -1471,6 +1473,37 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type) }
#endif
+#ifdef PNG_WRITE_eXIf_SUPPORTED
+/* Write the Exif data */
+void /* PRIVATE */
+png_write_eXIf(png_structrp png_ptr, png_bytep exif, int num_exif)
+{
+ int i;
+ png_byte buf[3];
+
+ png_debug(1, "in png_write_eXIf");
+
+ if (num_exif > (int)png_ptr->num_exif)
+ {
+ png_debug2(3, "num_exif = %d, png_ptr->num_exif = %d", num_exif,
+ png_ptr->num_exif);
+
+ png_warning(png_ptr, "Invalid number of exif bytes specified");
+ return;
+ }
+
+ png_write_chunk_header(png_ptr, png_eXIf, (png_uint_32)(num_exif));
+
+ for (i = 0; i < num_exif; i++)
+ {
+ buf[i] = exif[i];
+ png_write_chunk_data(png_ptr, buf, (png_size_t)1);
+ }
+
+ png_write_chunk_end(png_ptr);
+}
+#endif
+
#ifdef PNG_WRITE_hIST_SUPPORTED
/* Write the histogram */
void /* PRIVATE */
|