Skip to content

Commit

Permalink
Update bundled libpng to version 1.6.41
Browse files Browse the repository at this point in the history
[ChangeLog][Third-Party Code] libpng was updated to version 1.6.41

Pick-to: 6.7 6.6 6.6.2 6.5 6.2 5.15
Change-Id: I3285bfa11f61c571ffda1b365011a5c6a798ca68
Reviewed-by: Kai Köhne <[email protected]>
  • Loading branch information
aavit committed Jan 31, 2024
1 parent 4634fbf commit 528032c
Show file tree
Hide file tree
Showing 21 changed files with 427 additions and 306 deletions.
50 changes: 37 additions & 13 deletions src/3rdparty/libpng/ANNOUNCE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
libpng 1.6.40 - June 21, 2023
=============================
libpng 1.6.41 - January 24, 2024
================================

This is a public release of libpng, intended for use in production code.

Expand All @@ -9,13 +9,13 @@ Files available for download

Source files with LF line endings (for Unix/Linux):

* libpng-1.6.40.tar.xz (LZMA-compressed, recommended)
* libpng-1.6.40.tar.gz
* libpng-1.6.41.tar.xz (LZMA-compressed, recommended)
* libpng-1.6.41.tar.gz (deflate-compressed)

Source files with CRLF line endings (for Windows):

* lpng1640.7z (LZMA-compressed, recommended)
* lpng1640.zip
* lpng1641.7z (LZMA-compressed, recommended)
* lpng1641.zip (deflate-compressed)

Other information:

Expand All @@ -25,15 +25,39 @@ Other information:
* TRADEMARK.md


Changes from version 1.6.39 to version 1.6.40
Changes from version 1.6.40 to version 1.6.41
---------------------------------------------

* Fixed the eXIf chunk multiplicity checks.
* Fixed a memory leak in pCAL processing.
* Corrected the validity report about tRNS inside png_get_valid().
* Fixed various build issues on *BSD, Mac and Windows.
* Updated the configurations and the scripts for continuous integration.
* Cleaned up the code, the build scripts, and the documentation.
* Added SIMD-optimized code for the Loongarch LSX hardware.
(Contributed by GuXiWei, JinBo and ZhangLixia)
* Fixed the run-time discovery of MIPS MSA hardware.
(Contributed by Sui Jingfeng)
* Fixed an off-by-one error in the function `png_do_check_palette_indexes`,
which failed to recognize errors that might have existed in the first
column of a broken palette-encoded image. This was a benign regression
accidentally introduced in libpng-1.6.33. No pixel was harmed.
(Contributed by Adam Richter; reviewed by John Bowler)
* Fixed, improved and modernized the contrib/pngminus programs, i.e.,
png2pnm.c and pnm2png.c
* Removed old and peculiar portability hacks that were meant to silence
warnings issued by gcc version 7.1 alone.
(Contributed by John Bowler)
* Fixed and modernized the CMake file, and raised the minimum required
CMake version from 3.1 to 3.6.
(Contributed by Clinton Ingram, Timothy Lyanguzov, Tyler Kropp, et al.)
* Allowed the configure script to disable the building of auxiliary tools
and tests, thus catching up with the CMake file.
(Contributed by Carlo Bramini)
* Fixed a build issue on Mac.
(Contributed by Zixu Wang)
* Moved the Autoconf macro files to scripts/autoconf.
* Moved the CMake files (except for the main CMakeLists.txt) to
scripts/cmake and moved the list of their contributing authors to
scripts/cmake/AUTHORS.md
* Updated the CI configurations and scripts.
* Relicensed the CI scripts to the MIT License.
* Improved the test coverage.
(Contributed by John Bowler)


Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Expand Down
32 changes: 32 additions & 0 deletions src/3rdparty/libpng/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -6129,6 +6129,38 @@ Version 1.6.40 [June 21, 2023]
Updated the configurations and the scripts for continuous integration.
Cleaned up the code, the build scripts, and the documentation.

Version 1.6.41 [January 24, 2024]
Added SIMD-optimized code for the Loongarch LSX hardware.
(Contributed by GuXiWei, JinBo and ZhangLixia)
Fixed the run-time discovery of MIPS MSA hardware.
(Contributed by Sui Jingfeng)
Fixed an off-by-one error in the function `png_do_check_palette_indexes`,
which failed to recognize errors that might have existed in the first
column of a broken palette-encoded image. This was a benign regression
accidentally introduced in libpng-1.6.33. No pixel was harmed.
(Contributed by Adam Richter; reviewed by John Bowler)
Fixed, improved and modernized the contrib/pngminus programs, i.e.,
png2pnm.c and pnm2png.c
Removed old and peculiar portability hacks that were meant to silence
warnings issued by gcc version 7.1 alone.
(Contributed by John Bowler)
Fixed and modernized the CMake file, and raised the minimum required
CMake version from 3.1 to 3.6.
(Contributed by Clinton Ingram, Timothy Lyanguzov, Tyler Kropp, et al.)
Allowed the configure script to disable the building of auxiliary tools
and tests, thus catching up with the CMake file.
(Contributed by Carlo Bramini)
Fixed a build issue on Mac.
(Contributed by Zixu Wang)
Moved the Autoconf macro files to scripts/autoconf.
Moved the CMake files (except for the main CMakeLists.txt) to
scripts/cmake and moved the list of their contributing authors to
scripts/cmake/AUTHORS.md
Updated the CI configurations and scripts.
Relicensed the CI scripts to the MIT License.
Improved the test coverage.
(Contributed by John Bowler)

Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
Expand Down
4 changes: 2 additions & 2 deletions src/3rdparty/libpng/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
PNG Reference Library License version 2
---------------------------------------

* Copyright (c) 1995-2023 The PNG Reference Library Authors.
* Copyright (c) 2018-2023 Cosmin Truta.
* Copyright (c) 1995-2024 The PNG Reference Library Authors.
* Copyright (c) 2018-2024 Cosmin Truta.
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
* Copyright (c) 1996-1997 Andreas Dilger.
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
Expand Down
2 changes: 1 addition & 1 deletion src/3rdparty/libpng/README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
README for libpng version 1.6.40
README for libpng version 1.6.41
================================

See the note about version numbers near the top of `png.h`.
Expand Down
6 changes: 3 additions & 3 deletions src/3rdparty/libpng/libpng-manual.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng

Copyright (c) 2018-2023 Cosmin Truta
Copyright (c) 2018-2024 Cosmin Truta
Copyright (c) 1998-2018 Glenn Randers-Pehrson

This document is released under the libpng license.
Expand All @@ -9,9 +9,9 @@ libpng-manual.txt - A description on how to use and modify libpng

Based on:

libpng version 1.6.36, December 2018, through 1.6.40 - June 2023
libpng version 1.6.36, December 2018, through 1.6.41 - January 2024
Updated and distributed by Cosmin Truta
Copyright (c) 2018-2023 Cosmin Truta
Copyright (c) 2018-2024 Cosmin Truta

libpng versions 0.97, January 1998, through 1.6.35 - July 2018
Updated and distributed by Glenn Randers-Pehrson
Expand Down
73 changes: 14 additions & 59 deletions src/3rdparty/libpng/png.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

/* png.c - location for general purpose libpng functions
*
* Copyright (c) 2018-2023 Cosmin Truta
* Copyright (c) 2018-2024 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
Expand All @@ -14,27 +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_40 Your_png_h_is_not_version_1_6_40;

#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
typedef png_libpng_version_1_6_41 Your_png_h_is_not_version_1_6_41;

/* 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
Expand Down Expand Up @@ -73,21 +53,21 @@ png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
int PNGAPI
png_sig_cmp(png_const_bytep sig, size_t start, size_t num_to_check)
{
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
static const png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};

if (num_to_check > 8)
num_to_check = 8;

else if (num_to_check < 1)
return (-1);
return -1;

if (start > 7)
return (-1);
return -1;

if (start + num_to_check > 8)
num_to_check = 8 - start;

return ((int)(memcmp(&sig[start], &png_signature[start], num_to_check)));
return memcmp(&sig[start], &png_signature[start], num_to_check);
}

#endif /* READ */
Expand Down Expand Up @@ -447,7 +427,6 @@ png_info_init_3,(png_infopp ptr_ptr, size_t png_info_struct_size),
memset(info_ptr, 0, (sizeof *info_ptr));
}

/* The following API is not called internally */
void PNGAPI
png_data_freer(png_const_structrp png_ptr, png_inforp info_ptr,
int freer, png_uint_32 mask)
Expand Down Expand Up @@ -686,9 +665,9 @@ png_voidp PNGAPI
png_get_io_ptr(png_const_structrp png_ptr)
{
if (png_ptr == NULL)
return (NULL);
return NULL;

return (png_ptr->io_ptr);
return png_ptr->io_ptr;
}

#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
Expand Down Expand Up @@ -752,7 +731,7 @@ png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime)

{
size_t pos = 0;
char number_buf[5]; /* enough for a four-digit year */
char number_buf[5] = {0, 0, 0, 0, 0}; /* enough for a four-digit year */

# define APPEND_STRING(string) pos = png_safecat(out, 29, pos, (string))
# define APPEND_NUMBER(format, value)\
Expand Down Expand Up @@ -815,8 +794,8 @@ png_get_copyright(png_const_structrp png_ptr)
return PNG_STRING_COPYRIGHT
#else
return PNG_STRING_NEWLINE \
"libpng version 1.6.40" PNG_STRING_NEWLINE \
"Copyright (c) 2018-2023 Cosmin Truta" PNG_STRING_NEWLINE \
"libpng version 1.6.41" PNG_STRING_NEWLINE \
"Copyright (c) 2018-2024 Cosmin Truta" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
Expand Down Expand Up @@ -977,7 +956,7 @@ png_reset_zstream(png_structrp png_ptr)
return Z_STREAM_ERROR;

/* WARNING: this resets the window bits to the maximum! */
return (inflateReset(&png_ptr->zstream));
return inflateReset(&png_ptr->zstream);
}
#endif /* READ */

Expand All @@ -986,7 +965,7 @@ png_uint_32 PNGAPI
png_access_version_number(void)
{
/* Version of *.c files used when building libpng */
return((png_uint_32)PNG_LIBPNG_VER);
return (png_uint_32)PNG_LIBPNG_VER;
}

#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
Expand Down Expand Up @@ -2891,14 +2870,6 @@ 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, size_t size,
double fp, unsigned int precision)
Expand Down Expand Up @@ -3220,10 +3191,6 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, 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 */

# ifdef PNG_FIXED_POINT_SUPPORTED
Expand Down Expand Up @@ -3251,7 +3218,7 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
if (num <= 0x80000000) /* else overflowed */
{
unsigned int ndigits = 0, first = 16 /* flag value */;
char digits[10];
char digits[10] = {0};

while (num)
{
Expand Down Expand Up @@ -3336,15 +3303,6 @@ 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)
Expand Down Expand Up @@ -3459,9 +3417,6 @@ 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)
Expand Down
Loading

0 comments on commit 528032c

Please sign in to comment.