1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-05 19:31:35 +00:00

Merge pull request #113961 from akien-mga/libpng-1.6.53

libpng: Update to 1.6.53
This commit is contained in:
Thaddeus Crews
2025-12-15 08:00:56 -06:00
7 changed files with 51 additions and 25 deletions

View File

@@ -595,7 +595,7 @@ Files extracted from upstream source:
## libpng ## libpng
- Upstream: http://libpng.org/pub/png/libpng.html - Upstream: http://libpng.org/pub/png/libpng.html
- Version: 1.6.51 (49363adcfaf098748d7a4c8c624ad8c45a8c3a86, 2025) - Version: 1.6.53 (4e3f57d50f552841550a36eabbb3fbcecacb7750, 2025)
- License: libpng/zlib - License: libpng/zlib
Files extracted from upstream source: Files extracted from upstream source:

View File

@@ -13,7 +13,7 @@
#include "pngpriv.h" #include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_6_51 Your_png_h_is_not_version_1_6_51; typedef png_libpng_version_1_6_53 Your_png_h_is_not_version_1_6_53;
/* Sanity check the chunks definitions - PNG_KNOWN_CHUNKS from pngpriv.h and the /* Sanity check the chunks definitions - PNG_KNOWN_CHUNKS from pngpriv.h and the
* corresponding macro definitions. This causes a compile time failure if * corresponding macro definitions. This causes a compile time failure if
@@ -817,7 +817,7 @@ png_get_copyright(png_const_structrp png_ptr)
return PNG_STRING_COPYRIGHT return PNG_STRING_COPYRIGHT
#else #else
return PNG_STRING_NEWLINE \ return PNG_STRING_NEWLINE \
"libpng version 1.6.51" PNG_STRING_NEWLINE \ "libpng version 1.6.53" PNG_STRING_NEWLINE \
"Copyright (c) 2018-2025 Cosmin Truta" PNG_STRING_NEWLINE \ "Copyright (c) 2018-2025 Cosmin Truta" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \ "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
PNG_STRING_NEWLINE \ PNG_STRING_NEWLINE \

View File

@@ -1,6 +1,6 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.6.51 * libpng version 1.6.53
* *
* Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
@@ -14,7 +14,7 @@
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.6.35, July 2018: * libpng versions 0.97, January 1998, through 1.6.35, July 2018:
* Glenn Randers-Pehrson * Glenn Randers-Pehrson
* libpng versions 1.6.36, December 2018, through 1.6.51, November 2025: * libpng versions 1.6.36, December 2018, through 1.6.53, December 2025:
* Cosmin Truta * Cosmin Truta
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
*/ */
@@ -238,7 +238,7 @@
* ... * ...
* 1.5.30 15 10530 15.so.15.30[.0] * 1.5.30 15 10530 15.so.15.30[.0]
* ... * ...
* 1.6.51 16 10651 16.so.16.51[.0] * 1.6.53 16 10651 16.so.16.53[.0]
* *
* Henceforth the source version will match the shared-library major and * Henceforth the source version will match the shared-library major and
* minor numbers; the shared-library major version number will be used for * minor numbers; the shared-library major version number will be used for
@@ -274,7 +274,7 @@
*/ */
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.6.51" #define PNG_LIBPNG_VER_STRING "1.6.53"
#define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n" #define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
/* The versions of shared library builds should stay in sync, going forward */ /* The versions of shared library builds should stay in sync, going forward */
@@ -285,7 +285,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6 #define PNG_LIBPNG_VER_MINOR 6
#define PNG_LIBPNG_VER_RELEASE 51 #define PNG_LIBPNG_VER_RELEASE 53
/* This should be zero for a public release, or non-zero for a /* This should be zero for a public release, or non-zero for a
* development version. * development version.
@@ -316,7 +316,7 @@
* From version 1.0.1 it is: * From version 1.0.1 it is:
* XXYYZZ, where XX=major, YY=minor, ZZ=release * XXYYZZ, where XX=major, YY=minor, ZZ=release
*/ */
#define PNG_LIBPNG_VER 10651 /* 1.6.51 */ #define PNG_LIBPNG_VER 10653 /* 1.6.53 */
/* Library configuration: these options cannot be changed after /* Library configuration: these options cannot be changed after
* the library has been built. * the library has been built.
@@ -426,7 +426,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h /* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number. * do not agree upon the version number.
*/ */
typedef char* png_libpng_version_1_6_51; typedef char* png_libpng_version_1_6_53;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
* *

View File

@@ -1,6 +1,6 @@
/* pngconf.h - machine-configurable file for libpng /* pngconf.h - machine-configurable file for libpng
* *
* libpng version 1.6.51 * libpng version 1.6.53
* *
* Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson

View File

@@ -1,6 +1,6 @@
/* pnglibconf.h - library build configuration */ /* pnglibconf.h - library build configuration */
/* libpng version 1.6.51 */ /* libpng version 1.6.53 */
/* Copyright (c) 2018-2025 Cosmin Truta */ /* Copyright (c) 2018-2025 Cosmin Truta */
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */ /* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */

View File

@@ -3207,6 +3207,7 @@ png_image_read_composite(png_voidp argument)
ptrdiff_t step_row = display->row_bytes; ptrdiff_t step_row = display->row_bytes;
unsigned int channels = unsigned int channels =
(image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1; (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
int optimize_alpha = (png_ptr->flags & PNG_FLAG_OPTIMIZE_ALPHA) != 0;
int pass; int pass;
for (pass = 0; pass < passes; ++pass) for (pass = 0; pass < passes; ++pass)
@@ -3263,20 +3264,44 @@ png_image_read_composite(png_voidp argument)
if (alpha < 255) /* else just use component */ if (alpha < 255) /* else just use component */
{ {
/* This is PNG_OPTIMIZED_ALPHA, the component value if (optimize_alpha != 0)
* is a linear 8-bit value. Combine this with the {
* current outrow[c] value which is sRGB encoded. /* This is PNG_OPTIMIZED_ALPHA, the component value
* Arithmetic here is 16-bits to preserve the output * is a linear 8-bit value. Combine this with the
* values correctly. * current outrow[c] value which is sRGB encoded.
*/ * Arithmetic here is 16-bits to preserve the output
component *= 257*255; /* =65535 */ * values correctly.
component += (255-alpha)*png_sRGB_table[outrow[c]]; */
component *= 257*255; /* =65535 */
component += (255-alpha)*png_sRGB_table[outrow[c]];
/* So 'component' is scaled by 255*65535 and is /* Clamp to the valid range to defend against
* therefore appropriate for the sRGB to linear * unforeseen cases where the data might be sRGB
* conversion table. * instead of linear premultiplied.
*/ * (Belt-and-suspenders for CVE-2025-66293.)
component = PNG_sRGB_FROM_LINEAR(component); */
if (component > 255*65535)
component = 255*65535;
/* So 'component' is scaled by 255*65535 and is
* therefore appropriate for the sRGB-to-linear
* conversion table.
*/
component = PNG_sRGB_FROM_LINEAR(component);
}
else
{
/* Compositing was already done on the palette
* entries. The data is sRGB premultiplied on black.
* Composite with the background in sRGB space.
* This is not gamma-correct, but matches what was
* done to the palette.
*/
png_uint_32 background = outrow[c];
component += ((255-alpha) * background + 127) / 255;
if (component > 255)
component = 255;
}
} }
outrow[c] = (png_byte)component; outrow[c] = (png_byte)component;

View File

@@ -1843,6 +1843,7 @@ png_init_read_transformations(png_structrp png_ptr)
* transformations elsewhere. * transformations elsewhere.
*/ */
png_ptr->transformations &= ~(PNG_COMPOSE | PNG_GAMMA); png_ptr->transformations &= ~(PNG_COMPOSE | PNG_GAMMA);
png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
} /* color_type == PNG_COLOR_TYPE_PALETTE */ } /* color_type == PNG_COLOR_TYPE_PALETTE */
/* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */ /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */