1599 lines
63 KiB
Diff
1599 lines
63 KiB
Diff
commit cb7fb728d4805ed4e9d62ce31cee7c948f3d5746
|
|
Author: Andrew John Hughes <andrew@openjdk.org>
|
|
Date: Wed Dec 17 13:51:51 2025 +0000
|
|
|
|
8372534: Update Libpng to 1.6.51
|
|
|
|
Backport-of: c7a489db9e4a7d696623fc2155a5504d9d2adb0d
|
|
|
|
diff --git a/make/modules/java.desktop/lib/ClientLibraries.gmk b/make/modules/java.desktop/lib/ClientLibraries.gmk
|
|
index a69b65180d7..5cb7501b6f4 100644
|
|
--- a/make/modules/java.desktop/lib/ClientLibraries.gmk
|
|
+++ b/make/modules/java.desktop/lib/ClientLibraries.gmk
|
|
@@ -236,7 +236,7 @@ ifeq ($(ENABLE_HEADLESS_ONLY), false)
|
|
DISABLED_WARNINGS_gcc_dgif_lib.c := sign-compare, \
|
|
DISABLED_WARNINGS_gcc_jcmaster.c := implicit-fallthrough, \
|
|
DISABLED_WARNINGS_gcc_jdphuff.c := shift-negative-value, \
|
|
- DISABLED_WARNINGS_gcc_png.c := maybe-uninitialized unused-function, \
|
|
+ DISABLED_WARNINGS_gcc_png.c := maybe-uninitialized, \
|
|
DISABLED_WARNINGS_gcc_pngerror.c := maybe-uninitialized, \
|
|
DISABLED_WARNINGS_gcc_splashscreen_gfx_impl.c := implicit-fallthrough \
|
|
maybe-uninitialized, \
|
|
@@ -247,7 +247,6 @@ ifeq ($(ENABLE_HEADLESS_ONLY), false)
|
|
DISABLED_WARNINGS_clang := deprecated-non-prototype, \
|
|
DISABLED_WARNINGS_clang_dgif_lib.c := sign-compare, \
|
|
DISABLED_WARNINGS_clang_gzwrite.c := format-nonliteral, \
|
|
- DISABLED_WARNINGS_clang_png.c := unused-function, \
|
|
DISABLED_WARNINGS_clang_splashscreen_impl.c := sign-compare \
|
|
unused-but-set-variable unused-function, \
|
|
DISABLED_WARNINGS_clang_splashscreen_png.c := \
|
|
diff --git a/src/java.desktop/share/legal/libpng.md b/src/java.desktop/share/legal/libpng.md
|
|
index d43ccf2e8e4..8899491c6c0 100644
|
|
--- a/src/java.desktop/share/legal/libpng.md
|
|
+++ b/src/java.desktop/share/legal/libpng.md
|
|
@@ -1,4 +1,4 @@
|
|
-## libpng v1.6.47
|
|
+## libpng v1.6.51
|
|
|
|
### libpng License
|
|
<pre>
|
|
@@ -9,7 +9,7 @@ ### libpng License
|
|
PNG Reference Library License version 2
|
|
---------------------------------------
|
|
|
|
-Copyright (c) 1995-2025 The PNG Reference Library Authors.
|
|
+Copyright (C) 1995-2025 The PNG Reference Library Authors.
|
|
Copyright (C) 2018-2025 Cosmin Truta
|
|
Copyright (C) 1998-2018 Glenn Randers-Pehrson
|
|
Copyright (C) 1996-1997 Andreas Dilger
|
|
@@ -173,6 +173,7 @@ ### AUTHORS File Information
|
|
* Lucas Chollet
|
|
* Magnus Holmgren
|
|
* Mandar Sahastrabuddhe
|
|
+ * Manfred Schlaegl
|
|
* Mans Rullgard
|
|
* Matt Sarett
|
|
* Mike Klein
|
|
@@ -184,6 +185,7 @@ ### AUTHORS File Information
|
|
* Samuel Williams
|
|
* Simon-Pierre Cadieux
|
|
* Tim Wegner
|
|
+ * Tobias Stoeckmann
|
|
* Tom Lane
|
|
* Tom Tanner
|
|
* Vadim Barkov
|
|
@@ -193,8 +195,9 @@ ### AUTHORS File Information
|
|
- Zixu Wang (王子旭)
|
|
* Arm Holdings
|
|
- Richard Townsend
|
|
- * Google Inc.
|
|
+ * Google LLC
|
|
- Dan Field
|
|
+ - Dragoș Tiselice
|
|
- Leon Scroggins III
|
|
- Matt Sarett
|
|
- Mike Klein
|
|
@@ -204,6 +207,8 @@ ### AUTHORS File Information
|
|
- GuXiWei (顾希伟)
|
|
- JinBo (金波)
|
|
- ZhangLixia (张利霞)
|
|
+ * Samsung Group
|
|
+ - Filip Wasil
|
|
|
|
The build projects, the build scripts, the test scripts, and other
|
|
files in the "projects", "scripts" and "tests" directories, have
|
|
@@ -214,3 +219,4 @@ ### AUTHORS File Information
|
|
other copyright owners, and are released under other open source
|
|
licenses.
|
|
```
|
|
+
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
|
|
index 834b5e19277..2478fd0fc08 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
|
|
@@ -6251,6 +6251,59 @@ Version 1.6.47 [February 18, 2025]
|
|
colorspace precedence rules, due to pre-existing colorspace checks.
|
|
(Reported by Bob Friesenhahn; fixed by John Bowler)
|
|
|
|
+Version 1.6.48 [April 30, 2025]
|
|
+ Fixed the floating-point version of the mDCv setter `png_set_mDCv`.
|
|
+ (Reported by Mohit Bakshi; fixed by John Bowler)
|
|
+ Added #error directives to discourage the inclusion of private
|
|
+ libpng implementation header files in PNG-supporting applications.
|
|
+ Added the CMake build option `PNG_LIBCONF_HEADER`, to be used as an
|
|
+ alternative to `DFA_XTRA`.
|
|
+ Removed the Travis CI configuration files, with heartfelt thanks for
|
|
+ their generous support of our project over the past five years!
|
|
+
|
|
+Version 1.6.49 [June 12, 2025]
|
|
+ Added SIMD-optimized code for the RISC-V Vector Extension (RVV).
|
|
+ (Contributed by Manfred Schlaegl, Dragos Tiselice and Filip Wasil)
|
|
+ Added various fixes and improvements to the build scripts and to
|
|
+ the sample code.
|
|
+
|
|
+Version 1.6.50 [July 1, 2025]
|
|
+ Improved the detection of the RVV Extension on the RISC-V platform.
|
|
+ (Contributed by Filip Wasil)
|
|
+ Replaced inline ASM with C intrinsics in the RVV code.
|
|
+ (Contributed by Filip Wasil)
|
|
+ Fixed a decoder defect in which unknown chunks trailing IDAT, set
|
|
+ to go through the unknown chunk handler, incorrectly triggered
|
|
+ out-of-place IEND errors.
|
|
+ (Contributed by John Bowler)
|
|
+ Fixed the CMake file for cross-platform builds that require `libm`.
|
|
+
|
|
+Version 1.6.51 [November 21, 2025]
|
|
+ Fixed CVE-2025-64505 (moderate severity):
|
|
+ Heap buffer overflow in `png_do_quantize` via malformed palette index.
|
|
+ (Reported by Samsung; analyzed by Fabio Gritti.)
|
|
+ Fixed CVE-2025-64506 (moderate severity):
|
|
+ Heap buffer over-read in `png_write_image_8bit` with 8-bit input and
|
|
+ `convert_to_8bit` enabled.
|
|
+ (Reported by Samsung and <weijinjinnihao@users.noreply.github.com>;
|
|
+ analyzed by Fabio Gritti.)
|
|
+ Fixed CVE-2025-64720 (high severity):
|
|
+ Buffer overflow in `png_image_read_composite` via incorrect palette
|
|
+ premultiplication.
|
|
+ (Reported by Samsung; analyzed by John Bowler.)
|
|
+ Fixed CVE-2025-65018 (high severity):
|
|
+ Heap buffer overflow in `png_combine_row` triggered via
|
|
+ `png_image_finish_read`.
|
|
+ (Reported by <yosiimich@users.noreply.github.com>.)
|
|
+ Fixed a memory leak in `png_set_quantize`.
|
|
+ (Reported by Samsung; analyzed by Fabio Gritti.)
|
|
+ Removed the experimental and incomplete ERROR_NUMBERS code.
|
|
+ (Contributed by Tobias Stoeckmann.)
|
|
+ Improved the RISC-V vector extension support; required RVV 1.0 or newer.
|
|
+ (Contributed by Filip Wasil.)
|
|
+ Added GitHub Actions workflows for automated testing.
|
|
+ Performed various refactorings and cleanups.
|
|
+
|
|
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
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/README b/src/java.desktop/share/native/libsplashscreen/libpng/README
|
|
index 57952fb215a..5ea329ee3da 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/README
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/README
|
|
@@ -1,4 +1,4 @@
|
|
-README for libpng version 1.6.47
|
|
+README for libpng version 1.6.51
|
|
================================
|
|
|
|
See the note about version numbers near the top of `png.h`.
|
|
@@ -147,6 +147,7 @@ Files included in this distribution
|
|
loongarch/ => Optimized code for LoongArch LSX
|
|
mips/ => Optimized code for MIPS MSA and MIPS MMI
|
|
powerpc/ => Optimized code for PowerPC VSX
|
|
+ riscv/ => Optimized code for the RISC-V platform
|
|
ci/ => Scripts for continuous integration
|
|
contrib/ => External contributions
|
|
arm-neon/ => Optimized code for the ARM-NEON platform
|
|
@@ -162,6 +163,7 @@ Files included in this distribution
|
|
programs demonstrating the use of pngusr.dfa
|
|
pngminus/ => Simple pnm2png and png2pnm programs
|
|
pngsuite/ => Test images
|
|
+ riscv-rvv/ => Optimized code for the RISC-V Vector platform
|
|
testpngs/ => Test images
|
|
tools/ => Various tools
|
|
visupng/ => VisualPng, a Windows viewer for PNG images
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/png.c b/src/java.desktop/share/native/libsplashscreen/libpng/png.c
|
|
index 7b6de2f8ec3..7d85e7c8d5f 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/png.c
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.c
|
|
@@ -42,7 +42,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_47 Your_png_h_is_not_version_1_6_47;
|
|
+typedef png_libpng_version_1_6_51 Your_png_h_is_not_version_1_6_51;
|
|
|
|
/* Sanity check the chunks definitions - PNG_KNOWN_CHUNKS from pngpriv.h and the
|
|
* corresponding macro definitions. This causes a compile time failure if
|
|
@@ -137,10 +137,16 @@ png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED)
|
|
if (png_ptr == NULL)
|
|
return NULL;
|
|
|
|
- if (items >= (~(png_alloc_size_t)0)/size)
|
|
+ /* This check against overflow is vestigial, dating back from
|
|
+ * the old times when png_zalloc used to be an exported function.
|
|
+ * We're still keeping it here for now, as an extra-cautious
|
|
+ * prevention against programming errors inside zlib, although it
|
|
+ * should rather be a debug-time assertion instead.
|
|
+ */
|
|
+ if (size != 0 && items >= (~(png_alloc_size_t)0) / size)
|
|
{
|
|
- png_warning (png_voidcast(png_structrp, png_ptr),
|
|
- "Potential overflow in png_zalloc()");
|
|
+ png_warning(png_voidcast(png_structrp, png_ptr),
|
|
+ "Potential overflow in png_zalloc()");
|
|
return NULL;
|
|
}
|
|
|
|
@@ -267,10 +273,6 @@ png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
|
|
png_warning(png_ptr, m);
|
|
#endif
|
|
|
|
-#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
|
- png_ptr->flags = 0;
|
|
-#endif
|
|
-
|
|
return 0;
|
|
}
|
|
|
|
@@ -729,7 +731,7 @@ png_get_io_ptr(png_const_structrp png_ptr)
|
|
* function of your own because "FILE *" isn't necessarily available.
|
|
*/
|
|
void PNGAPI
|
|
-png_init_io(png_structrp png_ptr, png_FILE_p fp)
|
|
+png_init_io(png_structrp png_ptr, FILE *fp)
|
|
{
|
|
png_debug(1, "in png_init_io");
|
|
|
|
@@ -844,7 +846,7 @@ png_get_copyright(png_const_structrp png_ptr)
|
|
return PNG_STRING_COPYRIGHT
|
|
#else
|
|
return PNG_STRING_NEWLINE \
|
|
- "libpng version 1.6.47" PNG_STRING_NEWLINE \
|
|
+ "libpng version 1.6.51" PNG_STRING_NEWLINE \
|
|
"Copyright (c) 2018-2025 Cosmin Truta" PNG_STRING_NEWLINE \
|
|
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
|
|
PNG_STRING_NEWLINE \
|
|
@@ -1520,7 +1522,7 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
|
|
}
|
|
#endif /* COLORSPACE */
|
|
|
|
-#ifdef PNG_iCCP_SUPPORTED
|
|
+#ifdef PNG_READ_iCCP_SUPPORTED
|
|
/* Error message generation */
|
|
static char
|
|
png_icc_tag_char(png_uint_32 byte)
|
|
@@ -1596,9 +1598,7 @@ png_icc_profile_error(png_const_structrp png_ptr, png_const_charp name,
|
|
|
|
return 0;
|
|
}
|
|
-#endif /* iCCP */
|
|
|
|
-#ifdef PNG_READ_iCCP_SUPPORTED
|
|
/* Encoded value of D50 as an ICC XYZNumber. From the ICC 2010 spec the value
|
|
* is XYZ(0.9642,1.0,0.8249), which scales to:
|
|
*
|
|
@@ -3998,7 +3998,7 @@ png_image_free_function(png_voidp argument)
|
|
# ifdef PNG_STDIO_SUPPORTED
|
|
if (cp->owned_file != 0)
|
|
{
|
|
- FILE *fp = png_voidcast(FILE*, cp->png_ptr->io_ptr);
|
|
+ FILE *fp = png_voidcast(FILE *, cp->png_ptr->io_ptr);
|
|
cp->owned_file = 0;
|
|
|
|
/* Ignore errors here. */
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/png.h b/src/java.desktop/share/native/libsplashscreen/libpng/png.h
|
|
index ede12c34fe6..d39ff73552c 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/png.h
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.h
|
|
@@ -29,7 +29,7 @@
|
|
* However, the following notice accompanied the original version of this
|
|
* file and, per its terms, should not be removed:
|
|
*
|
|
- * libpng version 1.6.47
|
|
+ * libpng version 1.6.51
|
|
*
|
|
* Copyright (c) 2018-2025 Cosmin Truta
|
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
|
@@ -43,7 +43,7 @@
|
|
* 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:
|
|
* Glenn Randers-Pehrson
|
|
- * libpng versions 1.6.36, December 2018, through 1.6.47, February 2025:
|
|
+ * libpng versions 1.6.36, December 2018, through 1.6.51, November 2025:
|
|
* Cosmin Truta
|
|
* See also "Contributing Authors", below.
|
|
*/
|
|
@@ -267,7 +267,7 @@
|
|
* ...
|
|
* 1.5.30 15 10530 15.so.15.30[.0]
|
|
* ...
|
|
- * 1.6.47 16 10647 16.so.16.47[.0]
|
|
+ * 1.6.51 16 10651 16.so.16.51[.0]
|
|
*
|
|
* Henceforth the source version will match the shared-library major and
|
|
* minor numbers; the shared-library major version number will be used for
|
|
@@ -303,7 +303,7 @@
|
|
*/
|
|
|
|
/* Version information for png.h - this should match the version in png.c */
|
|
-#define PNG_LIBPNG_VER_STRING "1.6.47"
|
|
+#define PNG_LIBPNG_VER_STRING "1.6.51"
|
|
#define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
|
|
|
|
/* The versions of shared library builds should stay in sync, going forward */
|
|
@@ -314,7 +314,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 47
|
|
+#define PNG_LIBPNG_VER_RELEASE 51
|
|
|
|
/* This should be zero for a public release, or non-zero for a
|
|
* development version.
|
|
@@ -345,7 +345,7 @@
|
|
* From version 1.0.1 it is:
|
|
* XXYYZZ, where XX=major, YY=minor, ZZ=release
|
|
*/
|
|
-#define PNG_LIBPNG_VER 10647 /* 1.6.47 */
|
|
+#define PNG_LIBPNG_VER 10651 /* 1.6.51 */
|
|
|
|
/* Library configuration: these options cannot be changed after
|
|
* the library has been built.
|
|
@@ -455,7 +455,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_47;
|
|
+typedef char* png_libpng_version_1_6_51;
|
|
|
|
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
|
*
|
|
@@ -1599,7 +1599,7 @@ PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr,
|
|
|
|
#ifdef PNG_STDIO_SUPPORTED
|
|
/* Initialize the input/output for the PNG file to the default functions. */
|
|
-PNG_EXPORT(74, void, png_init_io, (png_structrp png_ptr, png_FILE_p fp));
|
|
+PNG_EXPORT(74, void, png_init_io, (png_structrp png_ptr, FILE *fp));
|
|
#endif
|
|
|
|
/* Replace the (error and abort), and warning functions with user
|
|
@@ -3117,7 +3117,7 @@ PNG_EXPORT(234, int, png_image_begin_read_from_file, (png_imagep image,
|
|
*/
|
|
|
|
PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image,
|
|
- FILE* file));
|
|
+ FILE *file));
|
|
/* The PNG header is read from the stdio FILE object. */
|
|
#endif /* STDIO */
|
|
|
|
@@ -3192,7 +3192,7 @@ PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image,
|
|
PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
|
|
int convert_to_8_bit, const void *buffer, png_int_32 row_stride,
|
|
const void *colormap));
|
|
- /* Write the image to the given (FILE*). */
|
|
+ /* Write the image to the given FILE object. */
|
|
#endif /* SIMPLIFIED_WRITE_STDIO */
|
|
|
|
/* With all write APIs if image is in one of the linear formats with 16-bit
|
|
@@ -3332,26 +3332,45 @@ PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
|
|
* selected at run time.
|
|
*/
|
|
#ifdef PNG_SET_OPTION_SUPPORTED
|
|
+
|
|
+/* HARDWARE: ARM Neon SIMD instructions supported */
|
|
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
|
-# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
|
|
+# define PNG_ARM_NEON 0
|
|
#endif
|
|
-#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
|
|
-#define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
|
|
+
|
|
+/* SOFTWARE: Force maximum window */
|
|
+#define PNG_MAXIMUM_INFLATE_WINDOW 2
|
|
+
|
|
+/* SOFTWARE: Check ICC profile for sRGB */
|
|
+#define PNG_SKIP_sRGB_CHECK_PROFILE 4
|
|
+
|
|
+/* HARDWARE: MIPS MSA SIMD instructions supported */
|
|
#ifdef PNG_MIPS_MSA_API_SUPPORTED
|
|
-# define PNG_MIPS_MSA 6 /* HARDWARE: MIPS Msa SIMD instructions supported */
|
|
+# define PNG_MIPS_MSA 6
|
|
#endif
|
|
+
|
|
+/* SOFTWARE: Disable Adler32 check on IDAT */
|
|
#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
|
|
-# define PNG_IGNORE_ADLER32 8 /* SOFTWARE: disable Adler32 check on IDAT */
|
|
+# define PNG_IGNORE_ADLER32 8
|
|
#endif
|
|
+
|
|
+/* HARDWARE: PowerPC VSX SIMD instructions supported */
|
|
#ifdef PNG_POWERPC_VSX_API_SUPPORTED
|
|
-# define PNG_POWERPC_VSX 10 /* HARDWARE: PowerPC VSX SIMD instructions
|
|
- * supported */
|
|
+# define PNG_POWERPC_VSX 10
|
|
#endif
|
|
+
|
|
+/* HARDWARE: MIPS MMI SIMD instructions supported */
|
|
#ifdef PNG_MIPS_MMI_API_SUPPORTED
|
|
-# define PNG_MIPS_MMI 12 /* HARDWARE: MIPS MMI SIMD instructions supported */
|
|
+# define PNG_MIPS_MMI 12
|
|
+#endif
|
|
+
|
|
+/* HARDWARE: RISC-V RVV SIMD instructions supported */
|
|
+#ifdef PNG_RISCV_RVV_API_SUPPORTED
|
|
+# define PNG_RISCV_RVV 14
|
|
#endif
|
|
|
|
-#define PNG_OPTION_NEXT 14 /* Next option - numbers must be even */
|
|
+/* Next option - numbers must be even */
|
|
+#define PNG_OPTION_NEXT 16
|
|
|
|
/* Return values: NOTE: there are four values and 'off' is *not* zero */
|
|
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
|
|
index 70bca6fa1c9..4bc5f7bb468 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
|
|
@@ -29,7 +29,7 @@
|
|
* However, the following notice accompanied the original version of this
|
|
* file and, per its terms, should not be removed:
|
|
*
|
|
- * libpng version 1.6.47
|
|
+ * libpng version 1.6.51
|
|
*
|
|
* Copyright (c) 2018-2025 Cosmin Truta
|
|
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
|
|
@@ -248,25 +248,13 @@
|
|
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */
|
|
|
|
# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
|
|
-# error "PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed"
|
|
+# error PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed
|
|
# endif
|
|
|
|
-# if (defined(_MSC_VER) && _MSC_VER < 800) ||\
|
|
- (defined(__BORLANDC__) && __BORLANDC__ < 0x500)
|
|
- /* older Borland and MSC
|
|
- * compilers used '__export' and required this to be after
|
|
- * the type.
|
|
- */
|
|
-# ifndef PNG_EXPORT_TYPE
|
|
-# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
|
|
-# endif
|
|
-# define PNG_DLL_EXPORT __export
|
|
-# else /* newer compiler */
|
|
-# define PNG_DLL_EXPORT __declspec(dllexport)
|
|
-# ifndef PNG_DLL_IMPORT
|
|
-# define PNG_DLL_IMPORT __declspec(dllimport)
|
|
-# endif
|
|
-# endif /* compiler */
|
|
+# define PNG_DLL_EXPORT __declspec(dllexport)
|
|
+# ifndef PNG_DLL_IMPORT
|
|
+# define PNG_DLL_IMPORT __declspec(dllimport)
|
|
+# endif
|
|
|
|
#else /* !Windows */
|
|
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
|
|
@@ -508,7 +496,7 @@
|
|
#if CHAR_BIT == 8 && UCHAR_MAX == 255
|
|
typedef unsigned char png_byte;
|
|
#else
|
|
-# error "libpng requires 8-bit bytes"
|
|
+# error libpng requires 8-bit bytes
|
|
#endif
|
|
|
|
#if INT_MIN == -32768 && INT_MAX == 32767
|
|
@@ -516,7 +504,7 @@
|
|
#elif SHRT_MIN == -32768 && SHRT_MAX == 32767
|
|
typedef short png_int_16;
|
|
#else
|
|
-# error "libpng requires a signed 16-bit type"
|
|
+# error libpng requires a signed 16-bit integer type
|
|
#endif
|
|
|
|
#if UINT_MAX == 65535
|
|
@@ -524,7 +512,7 @@
|
|
#elif USHRT_MAX == 65535
|
|
typedef unsigned short png_uint_16;
|
|
#else
|
|
-# error "libpng requires an unsigned 16-bit type"
|
|
+# error libpng requires an unsigned 16-bit integer type
|
|
#endif
|
|
|
|
#if INT_MIN < -2147483646 && INT_MAX > 2147483646
|
|
@@ -532,7 +520,7 @@
|
|
#elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
|
|
typedef long int png_int_32;
|
|
#else
|
|
-# error "libpng requires a signed 32-bit (or more) type"
|
|
+# error libpng requires a signed 32-bit (or longer) integer type
|
|
#endif
|
|
|
|
#if UINT_MAX > 4294967294U
|
|
@@ -540,7 +528,7 @@
|
|
#elif ULONG_MAX > 4294967294U
|
|
typedef unsigned long int png_uint_32;
|
|
#else
|
|
-# error "libpng requires an unsigned 32-bit (or more) type"
|
|
+# error libpng requires an unsigned 32-bit (or longer) integer type
|
|
#endif
|
|
|
|
/* Prior to 1.6.0, it was possible to disable the use of size_t and ptrdiff_t.
|
|
@@ -621,10 +609,6 @@ typedef const png_fixed_point * png_const_fixed_point_p;
|
|
typedef size_t * png_size_tp;
|
|
typedef const size_t * png_const_size_tp;
|
|
|
|
-#ifdef PNG_STDIO_SUPPORTED
|
|
-typedef FILE * png_FILE_p;
|
|
-#endif
|
|
-
|
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
|
typedef double * png_doublep;
|
|
typedef const double * png_const_doublep;
|
|
@@ -646,6 +630,15 @@ typedef double * * png_doublepp;
|
|
/* Pointers to pointers to pointers; i.e., pointer to array */
|
|
typedef char * * * png_charppp;
|
|
|
|
+#ifdef PNG_STDIO_SUPPORTED
|
|
+/* With PNG_STDIO_SUPPORTED it was possible to use I/O streams that were
|
|
+ * not necessarily stdio FILE streams, to allow building Windows applications
|
|
+ * before Win32 and Windows CE applications before WinCE 3.0, but that kind
|
|
+ * of support has long been discontinued.
|
|
+ */
|
|
+typedef FILE * png_FILE_p; /* [Deprecated] */
|
|
+#endif
|
|
+
|
|
#endif /* PNG_BUILDING_SYMBOL_TABLE */
|
|
|
|
#endif /* PNGCONF_H */
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngdebug.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngdebug.h
|
|
index 8eb5400ea9a..6ea2644dfcd 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngdebug.h
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngdebug.h
|
|
@@ -22,14 +22,14 @@
|
|
* questions.
|
|
*/
|
|
|
|
-/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
|
|
+/* pngdebug.h - internal debugging macros for libpng
|
|
*
|
|
* This file is available under and governed by the GNU General Public
|
|
* License version 2 only, as published by the Free Software Foundation.
|
|
* However, the following notice accompanied the original version of this
|
|
* file and, per its terms, should not be removed:
|
|
*
|
|
- * Copyright (c) 2018 Cosmin Truta
|
|
+ * Copyright (c) 2018-2025 Cosmin Truta
|
|
* Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
|
|
* Copyright (c) 1996-1997 Andreas Dilger
|
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
|
@@ -39,6 +39,10 @@
|
|
* and license in png.h
|
|
*/
|
|
|
|
+#ifndef PNGPRIV_H
|
|
+# error This file must not be included by applications; please include <png.h>
|
|
+#endif
|
|
+
|
|
/* Define PNG_DEBUG at compile time for debugging information. Higher
|
|
* numbers for PNG_DEBUG mean more debugging information. This has
|
|
* only been added since version 0.95 so it is not implemented throughout
|
|
@@ -63,9 +67,6 @@
|
|
#define PNGDEBUG_H
|
|
/* These settings control the formatting of messages in png.c and pngerror.c */
|
|
/* Moved to pngdebug.h at 1.5.0 */
|
|
-# ifndef PNG_LITERAL_SHARP
|
|
-# define PNG_LITERAL_SHARP 0x23
|
|
-# endif
|
|
# ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
|
|
# define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
|
|
# endif
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c
|
|
index ea0103331d3..44c86ebfef9 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c
|
|
@@ -29,7 +29,7 @@
|
|
* However, the following notice accompanied the original version of this
|
|
* file and, per its terms, should not be removed:
|
|
*
|
|
- * Copyright (c) 2018-2024 Cosmin Truta
|
|
+ * Copyright (c) 2018-2025 Cosmin Truta
|
|
* 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.
|
|
@@ -68,46 +68,6 @@ PNG_FUNCTION(void,PNGAPI
|
|
png_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
|
PNG_NORETURN)
|
|
{
|
|
-#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
|
- char msg[16];
|
|
- if (png_ptr != NULL)
|
|
- {
|
|
- if ((png_ptr->flags &
|
|
- (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
|
|
- {
|
|
- if (*error_message == PNG_LITERAL_SHARP)
|
|
- {
|
|
- /* Strip "#nnnn " from beginning of error message. */
|
|
- int offset;
|
|
- for (offset = 1; offset<15; offset++)
|
|
- if (error_message[offset] == ' ')
|
|
- break;
|
|
-
|
|
- if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
|
|
- {
|
|
- int i;
|
|
- for (i = 0; i < offset - 1; i++)
|
|
- msg[i] = error_message[i + 1];
|
|
- msg[i - 1] = '\0';
|
|
- error_message = msg;
|
|
- }
|
|
-
|
|
- else
|
|
- error_message += offset;
|
|
- }
|
|
-
|
|
- else
|
|
- {
|
|
- if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
|
|
- {
|
|
- msg[0] = '0';
|
|
- msg[1] = '\0';
|
|
- error_message = msg;
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
-#endif
|
|
if (png_ptr != NULL && png_ptr->error_fn != NULL)
|
|
(*(png_ptr->error_fn))(png_constcast(png_structrp,png_ptr),
|
|
error_message);
|
|
@@ -245,21 +205,6 @@ void PNGAPI
|
|
png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
|
|
{
|
|
int offset = 0;
|
|
- if (png_ptr != NULL)
|
|
- {
|
|
-#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
|
- if ((png_ptr->flags &
|
|
- (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
|
|
-#endif
|
|
- {
|
|
- if (*warning_message == PNG_LITERAL_SHARP)
|
|
- {
|
|
- for (offset = 1; offset < 15; offset++)
|
|
- if (warning_message[offset] == ' ')
|
|
- break;
|
|
- }
|
|
- }
|
|
- }
|
|
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
|
|
(*(png_ptr->warning_fn))(png_constcast(png_structrp,png_ptr),
|
|
warning_message + offset);
|
|
@@ -741,42 +686,9 @@ png_default_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
|
PNG_NORETURN)
|
|
{
|
|
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
|
-#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
|
- /* Check on NULL only added in 1.5.4 */
|
|
- if (error_message != NULL && *error_message == PNG_LITERAL_SHARP)
|
|
- {
|
|
- /* Strip "#nnnn " from beginning of error message. */
|
|
- int offset;
|
|
- char error_number[16];
|
|
- for (offset = 0; offset<15; offset++)
|
|
- {
|
|
- error_number[offset] = error_message[offset + 1];
|
|
- if (error_message[offset] == ' ')
|
|
- break;
|
|
- }
|
|
-
|
|
- if ((offset > 1) && (offset < 15))
|
|
- {
|
|
- error_number[offset - 1] = '\0';
|
|
- fprintf(stderr, "libpng error no. %s: %s",
|
|
- error_number, error_message + offset + 1);
|
|
- fprintf(stderr, PNG_STRING_NEWLINE);
|
|
- }
|
|
-
|
|
- else
|
|
- {
|
|
- fprintf(stderr, "libpng error: %s, offset=%d",
|
|
- error_message, offset);
|
|
- fprintf(stderr, PNG_STRING_NEWLINE);
|
|
- }
|
|
- }
|
|
- else
|
|
-#endif
|
|
- {
|
|
- fprintf(stderr, "libpng error: %s", error_message ? error_message :
|
|
- "undefined");
|
|
- fprintf(stderr, PNG_STRING_NEWLINE);
|
|
- }
|
|
+ fprintf(stderr, "libpng error: %s", error_message ? error_message :
|
|
+ "undefined");
|
|
+ fprintf(stderr, PNG_STRING_NEWLINE);
|
|
#else
|
|
PNG_UNUSED(error_message) /* Make compiler happy */
|
|
#endif
|
|
@@ -814,40 +726,8 @@ static void /* PRIVATE */
|
|
png_default_warning(png_const_structrp png_ptr, png_const_charp warning_message)
|
|
{
|
|
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
|
-# ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
|
- if (*warning_message == PNG_LITERAL_SHARP)
|
|
- {
|
|
- int offset;
|
|
- char warning_number[16];
|
|
- for (offset = 0; offset < 15; offset++)
|
|
- {
|
|
- warning_number[offset] = warning_message[offset + 1];
|
|
- if (warning_message[offset] == ' ')
|
|
- break;
|
|
- }
|
|
-
|
|
- if ((offset > 1) && (offset < 15))
|
|
- {
|
|
- warning_number[offset + 1] = '\0';
|
|
- fprintf(stderr, "libpng warning no. %s: %s",
|
|
- warning_number, warning_message + offset);
|
|
- fprintf(stderr, PNG_STRING_NEWLINE);
|
|
- }
|
|
-
|
|
- else
|
|
- {
|
|
- fprintf(stderr, "libpng warning: %s",
|
|
- warning_message);
|
|
- fprintf(stderr, PNG_STRING_NEWLINE);
|
|
- }
|
|
- }
|
|
- else
|
|
-# endif
|
|
-
|
|
- {
|
|
- fprintf(stderr, "libpng warning: %s", warning_message);
|
|
- fprintf(stderr, PNG_STRING_NEWLINE);
|
|
- }
|
|
+ fprintf(stderr, "libpng warning: %s", warning_message);
|
|
+ fprintf(stderr, PNG_STRING_NEWLINE);
|
|
#else
|
|
PNG_UNUSED(warning_message) /* Make compiler happy */
|
|
#endif
|
|
@@ -895,12 +775,8 @@ png_get_error_ptr(png_const_structrp png_ptr)
|
|
void PNGAPI
|
|
png_set_strip_error_numbers(png_structrp png_ptr, png_uint_32 strip_mode)
|
|
{
|
|
- if (png_ptr != NULL)
|
|
- {
|
|
- png_ptr->flags &=
|
|
- ((~(PNG_FLAG_STRIP_ERROR_NUMBERS |
|
|
- PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
|
|
- }
|
|
+ PNG_UNUSED(png_ptr)
|
|
+ PNG_UNUSED(strip_mode)
|
|
}
|
|
#endif
|
|
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c
|
|
index d67adbae247..ed2e7f886f5 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c
|
|
@@ -29,7 +29,7 @@
|
|
* However, the following notice accompanied the original version of this
|
|
* file and, per its terms, should not be removed:
|
|
*
|
|
- * Copyright (c) 2018-2024 Cosmin Truta
|
|
+ * Copyright (c) 2018-2025 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.
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h b/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h
|
|
index bc6ed3d09c9..c79c6cc780f 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h
|
|
@@ -22,14 +22,14 @@
|
|
* questions.
|
|
*/
|
|
|
|
-/* pnginfo.h - header file for PNG reference library
|
|
+/* pnginfo.h - internal structures for libpng
|
|
*
|
|
* This file is available under and governed by the GNU General Public
|
|
* License version 2 only, as published by the Free Software Foundation.
|
|
* However, the following notice accompanied the original version of this
|
|
* file and, per its terms, should not be removed:
|
|
*
|
|
- * Copyright (c) 2018 Cosmin Truta
|
|
+ * Copyright (c) 2018-2025 Cosmin Truta
|
|
* Copyright (c) 1998-2002,2004,2006-2013,2018 Glenn Randers-Pehrson
|
|
* Copyright (c) 1996-1997 Andreas Dilger
|
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
|
@@ -39,43 +39,20 @@
|
|
* and license in png.h
|
|
*/
|
|
|
|
- /* png_info is a structure that holds the information in a PNG file so
|
|
- * that the application can find out the characteristics of the image.
|
|
- * If you are reading the file, this structure will tell you what is
|
|
- * in the PNG file. If you are writing the file, fill in the information
|
|
- * you want to put into the PNG file, using png_set_*() functions, then
|
|
- * call png_write_info().
|
|
- *
|
|
- * The names chosen should be very close to the PNG specification, so
|
|
- * consult that document for information about the meaning of each field.
|
|
- *
|
|
- * With libpng < 0.95, it was only possible to directly set and read the
|
|
- * the values in the png_info_struct, which meant that the contents and
|
|
- * order of the values had to remain fixed. With libpng 0.95 and later,
|
|
- * however, there are now functions that abstract the contents of
|
|
- * png_info_struct from the application, so this makes it easier to use
|
|
- * libpng with dynamic libraries, and even makes it possible to use
|
|
- * libraries that don't have all of the libpng ancillary chunk-handing
|
|
- * functionality. In libpng-1.5.0 this was moved into a separate private
|
|
- * file that is not visible to applications.
|
|
+#ifndef PNGPRIV_H
|
|
+# error This file must not be included by applications; please include <png.h>
|
|
+#endif
|
|
+
|
|
+/* INTERNAL, PRIVATE definition of a PNG.
|
|
*
|
|
- * The following members may have allocated storage attached that should be
|
|
- * cleaned up before the structure is discarded: palette, trans, text,
|
|
- * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
|
|
- * splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
|
|
- * are automatically freed when the info structure is deallocated, if they were
|
|
- * allocated internally by libpng. This behavior can be changed by means
|
|
- * of the png_data_freer() function.
|
|
+ * png_info is a modifiable description of a PNG datastream. The fields inside
|
|
+ * this structure are accessed through png_get_<CHUNK>() functions and modified
|
|
+ * using png_set_<CHUNK>() functions.
|
|
*
|
|
- * More allocation details: all the chunk-reading functions that
|
|
- * change these members go through the corresponding png_set_*
|
|
- * functions. A function to clear these members is available: see
|
|
- * png_free_data(). The png_set_* functions do not depend on being
|
|
- * able to point info structure members to any of the storage they are
|
|
- * passed (they make their own copies), EXCEPT that the png_set_text
|
|
- * functions use the same storage passed to them in the text_ptr or
|
|
- * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
|
|
- * functions do not make their own copies.
|
|
+ * Some functions in libpng do directly access members of png_info. However,
|
|
+ * this should be avoided. png_struct objects contain members which hold
|
|
+ * caches, sometimes optimised, of the values from png_info objects, and
|
|
+ * png_info is not passed to the functions which read and write image data.
|
|
*/
|
|
#ifndef PNGINFO_H
|
|
#define PNGINFO_H
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h b/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
|
|
index 906f855db0e..4cfae474751 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
|
|
@@ -31,7 +31,7 @@
|
|
* However, the following notice accompanied the original version of this
|
|
* file and, per its terms, should not be removed:
|
|
*/
|
|
-/* libpng version 1.6.47 */
|
|
+/* libpng version 1.6.51 */
|
|
|
|
/* Copyright (c) 2018-2025 Cosmin Truta */
|
|
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c
|
|
index ba9eb4df402..12b71bcbc02 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c
|
|
@@ -29,7 +29,7 @@
|
|
* However, the following notice accompanied the original version of this
|
|
* file and, per its terms, should not be removed:
|
|
*
|
|
- * Copyright (c) 2018 Cosmin Truta
|
|
+ * Copyright (c) 2018-2025 Cosmin Truta
|
|
* Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson
|
|
* Copyright (c) 1996-1997 Andreas Dilger
|
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c
|
|
index 86d0c7aaa64..3bfa913000f 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c
|
|
@@ -29,7 +29,7 @@
|
|
* However, the following notice accompanied the original version of this
|
|
* file and, per its terms, should not be removed:
|
|
*
|
|
- * Copyright (c) 2018-2024 Cosmin Truta
|
|
+ * Copyright (c) 2018-2025 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.
|
|
@@ -258,6 +258,14 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|
png_benign_error(png_ptr, "Too many IDATs found");
|
|
}
|
|
|
|
+ else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
|
|
+ {
|
|
+ /* These flags must be set consistently for all non-IDAT chunks,
|
|
+ * including the unknown chunks.
|
|
+ */
|
|
+ png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT | PNG_AFTER_IDAT;
|
|
+ }
|
|
+
|
|
if (chunk_name == png_IHDR)
|
|
{
|
|
if (png_ptr->push_length != 13)
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h
|
|
index 25bac4b9e69..dcd005efb34 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h
|
|
@@ -29,7 +29,7 @@
|
|
* However, the following notice accompanied the original version of this
|
|
* file and, per its terms, should not be removed:
|
|
*
|
|
- * Copyright (c) 2018-2024 Cosmin Truta
|
|
+ * Copyright (c) 2018-2025 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.
|
|
@@ -48,8 +48,20 @@
|
|
* they should be well aware of the issues that may arise from doing so.
|
|
*/
|
|
|
|
+
|
|
+/* pngpriv.h must be included first in each translation unit inside libpng.
|
|
+ * On the other hand, it must not be included at all, directly or indirectly,
|
|
+ * by any application code that uses the libpng API.
|
|
+ */
|
|
#ifndef PNGPRIV_H
|
|
-#define PNGPRIV_H
|
|
+# define PNGPRIV_H
|
|
+#else
|
|
+# error Duplicate inclusion of pngpriv.h; please check the libpng source files
|
|
+#endif
|
|
+
|
|
+#if defined(PNG_H) || defined(PNGCONF_H) || defined(PNGLCONF_H)
|
|
+# error This file must not be included by applications; please include <png.h>
|
|
+#endif
|
|
|
|
/* Feature Test Macros. The following are defined here to ensure that correctly
|
|
* implemented libraries reveal the APIs libpng needs to build and hide those
|
|
@@ -86,7 +98,6 @@
|
|
*/
|
|
#if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
|
|
# include <config.h>
|
|
-
|
|
/* Pick up the definition of 'restrict' from config.h if it was read: */
|
|
# define PNG_RESTRICT restrict
|
|
#endif
|
|
@@ -96,9 +107,7 @@
|
|
* are not internal definitions may be required. This is handled below just
|
|
* before png.h is included, but load the configuration now if it is available.
|
|
*/
|
|
-#ifndef PNGLCONF_H
|
|
-# include "pnglibconf.h"
|
|
-#endif
|
|
+#include "pnglibconf.h"
|
|
|
|
/* Local renames may change non-exported API functions from png.h */
|
|
#if defined(PNG_PREFIX) && !defined(PNGPREFIX_H)
|
|
@@ -163,6 +172,20 @@
|
|
# endif
|
|
#endif
|
|
|
|
+#ifndef PNG_RISCV_RVV_OPT
|
|
+ /* RISCV_RVV optimizations are being controlled by the compiler settings,
|
|
+ * typically the target compiler will define __riscv but the rvv extension
|
|
+ * availability has to be explicitly stated. This is why if no
|
|
+ * PNG_RISCV_RVV_OPT was defined then a runtime check will be executed.
|
|
+ *
|
|
+ * To enable RISCV_RVV optimizations unconditionally, and compile the
|
|
+ * associated code, pass --enable-riscv-rvv=yes or --enable-riscv-rvv=on
|
|
+ * to configure or put -DPNG_RISCV_RVV_OPT=2 in CPPFLAGS.
|
|
+ */
|
|
+
|
|
+# define PNG_RISCV_RVV_OPT 0
|
|
+#endif
|
|
+
|
|
#if PNG_ARM_NEON_OPT > 0
|
|
/* NEON optimizations are to be at least considered by libpng, so enable the
|
|
* callbacks to do this.
|
|
@@ -308,6 +331,16 @@
|
|
# define PNG_LOONGARCH_LSX_IMPLEMENTATION 0
|
|
#endif
|
|
|
|
+#if PNG_RISCV_RVV_OPT > 0 && __riscv_v >= 1000000
|
|
+# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_rvv
|
|
+# ifndef PNG_RISCV_RVV_IMPLEMENTATION
|
|
+ /* Use the intrinsics code by default. */
|
|
+# define PNG_RISCV_RVV_IMPLEMENTATION 1
|
|
+# endif
|
|
+#else
|
|
+# define PNG_RISCV_RVV_IMPLEMENTATION 0
|
|
+#endif /* PNG_RISCV_RVV_OPT > 0 && __riscv_v >= 1000000 */
|
|
+
|
|
/* Is this a build of a DLL where compilation of the object modules requires
|
|
* different preprocessor settings to those required for a simple library? If
|
|
* so PNG_BUILD_DLL must be set.
|
|
@@ -706,7 +739,7 @@
|
|
/* #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000U */
|
|
/* #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000U */
|
|
#define PNG_FLAG_LIBRARY_MISMATCH 0x20000U
|
|
-#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000U
|
|
+ /* 0x40000U unused */
|
|
#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000U
|
|
#define PNG_FLAG_BENIGN_ERRORS_WARN 0x100000U /* Added to libpng-1.4.0 */
|
|
#define PNG_FLAG_APP_WARNINGS_WARN 0x200000U /* Added to libpng-1.6.0 */
|
|
@@ -1020,17 +1053,15 @@
|
|
* must match that used in the build, or we must be using pnglibconf.h.prebuilt:
|
|
*/
|
|
#if PNG_ZLIB_VERNUM != 0 && PNG_ZLIB_VERNUM != ZLIB_VERNUM
|
|
-# error ZLIB_VERNUM != PNG_ZLIB_VERNUM \
|
|
- "-I (include path) error: see the notes in pngpriv.h"
|
|
- /* This means that when pnglibconf.h was built the copy of zlib.h that it
|
|
- * used is not the same as the one being used here. Because the build of
|
|
- * libpng makes decisions to use inflateInit2 and inflateReset2 based on the
|
|
- * zlib version number and because this affects handling of certain broken
|
|
- * PNG files the -I directives must match.
|
|
+# error The include path of <zlib.h> is incorrect
|
|
+ /* When pnglibconf.h was built, the copy of zlib.h that it used was not the
|
|
+ * same as the one being used here. Considering how libpng makes decisions
|
|
+ * to use the zlib API based on the zlib version number, the -I options must
|
|
+ * match.
|
|
*
|
|
- * The most likely explanation is that you passed a -I in CFLAGS. This will
|
|
- * not work; all the preprocessor directives and in particular all the -I
|
|
- * directives must be in CPPFLAGS.
|
|
+ * A possible cause of this mismatch is that you passed an -I option in
|
|
+ * CFLAGS, which is unlikely to work. All the preprocessor options, and all
|
|
+ * the -I options in particular, should be in CPPFLAGS.
|
|
*/
|
|
#endif
|
|
|
|
@@ -1544,6 +1575,23 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_lsx,(png_row_infop
|
|
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
|
#endif
|
|
|
|
+#if PNG_RISCV_RVV_IMPLEMENTATION == 1
|
|
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_rvv,(png_row_infop
|
|
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
|
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_rvv,(png_row_infop
|
|
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
|
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_rvv,(png_row_infop
|
|
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
|
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_rvv,(png_row_infop
|
|
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
|
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_rvv,(png_row_infop
|
|
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
|
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_rvv,(png_row_infop
|
|
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
|
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_rvv,(png_row_infop
|
|
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
|
+#endif
|
|
+
|
|
/* Choose the best filter to use and filter the row data */
|
|
PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
|
|
png_row_infop row_info),PNG_EMPTY);
|
|
@@ -2156,6 +2204,11 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_lsx,
|
|
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
|
#endif
|
|
|
|
+# if PNG_RISCV_RVV_IMPLEMENTATION == 1
|
|
+PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_rvv,
|
|
+ (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
|
+#endif
|
|
+
|
|
PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
|
|
png_const_charp key, png_bytep new_key), PNG_EMPTY);
|
|
|
|
@@ -2191,4 +2244,3 @@ PNG_INTERNAL_FUNCTION(int,
|
|
#endif
|
|
|
|
#endif /* PNG_VERSION_INFO_ONLY */
|
|
-#endif /* PNGPRIV_H */
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c
|
|
index 8a6381e1b3e..b53668a09ce 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c
|
|
@@ -731,7 +731,12 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
|
|
png_uint_32 chunk_name = png_ptr->chunk_name;
|
|
|
|
if (chunk_name != png_IDAT)
|
|
- png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
|
|
+ {
|
|
+ /* These flags must be set consistently for all non-IDAT chunks,
|
|
+ * including the unknown chunks.
|
|
+ */
|
|
+ png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT | PNG_AFTER_IDAT;
|
|
+ }
|
|
|
|
if (chunk_name == png_IEND)
|
|
png_handle_chunk(png_ptr, info_ptr, length);
|
|
@@ -838,7 +843,8 @@ png_read_destroy(png_structrp png_ptr)
|
|
#endif
|
|
|
|
#if defined(PNG_READ_EXPAND_SUPPORTED) && \
|
|
- defined(PNG_ARM_NEON_IMPLEMENTATION)
|
|
+ (defined(PNG_ARM_NEON_IMPLEMENTATION) || \
|
|
+ defined(PNG_RISCV_RVV_IMPLEMENTATION))
|
|
png_free(png_ptr, png_ptr->riffled_palette);
|
|
png_ptr->riffled_palette = NULL;
|
|
#endif
|
|
@@ -1357,7 +1363,7 @@ png_image_read_header(png_voidp argument)
|
|
|
|
#ifdef PNG_STDIO_SUPPORTED
|
|
int PNGAPI
|
|
-png_image_begin_read_from_stdio(png_imagep image, FILE* file)
|
|
+png_image_begin_read_from_stdio(png_imagep image, FILE *file)
|
|
{
|
|
if (image != NULL && image->version == PNG_IMAGE_VERSION)
|
|
{
|
|
@@ -3152,6 +3158,54 @@ png_image_read_colormapped(png_voidp argument)
|
|
}
|
|
}
|
|
|
|
+/* Row reading for interlaced 16-to-8 bit depth conversion with local buffer. */
|
|
+static int
|
|
+png_image_read_direct_scaled(png_voidp argument)
|
|
+{
|
|
+ png_image_read_control *display = png_voidcast(png_image_read_control*,
|
|
+ argument);
|
|
+ png_imagep image = display->image;
|
|
+ png_structrp png_ptr = image->opaque->png_ptr;
|
|
+ png_bytep local_row = png_voidcast(png_bytep, display->local_row);
|
|
+ png_bytep first_row = png_voidcast(png_bytep, display->first_row);
|
|
+ ptrdiff_t row_bytes = display->row_bytes;
|
|
+ int passes;
|
|
+
|
|
+ /* Handle interlacing. */
|
|
+ switch (png_ptr->interlaced)
|
|
+ {
|
|
+ case PNG_INTERLACE_NONE:
|
|
+ passes = 1;
|
|
+ break;
|
|
+
|
|
+ case PNG_INTERLACE_ADAM7:
|
|
+ passes = PNG_INTERLACE_ADAM7_PASSES;
|
|
+ break;
|
|
+
|
|
+ default:
|
|
+ png_error(png_ptr, "unknown interlace type");
|
|
+ }
|
|
+
|
|
+ /* Read each pass using local_row as intermediate buffer. */
|
|
+ while (--passes >= 0)
|
|
+ {
|
|
+ png_uint_32 y = image->height;
|
|
+ png_bytep output_row = first_row;
|
|
+
|
|
+ for (; y > 0; --y)
|
|
+ {
|
|
+ /* Read into local_row (gets transformed 8-bit data). */
|
|
+ png_read_row(png_ptr, local_row, NULL);
|
|
+
|
|
+ /* Copy from local_row to user buffer. */
|
|
+ memcpy(output_row, local_row, (size_t)row_bytes);
|
|
+ output_row += row_bytes;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return 1;
|
|
+}
|
|
+
|
|
/* Just the row reading part of png_image_read. */
|
|
static int
|
|
png_image_read_composite(png_voidp argument)
|
|
@@ -3570,6 +3624,7 @@ png_image_read_direct(png_voidp argument)
|
|
int linear = (format & PNG_FORMAT_FLAG_LINEAR) != 0;
|
|
int do_local_compose = 0;
|
|
int do_local_background = 0; /* to avoid double gamma correction bug */
|
|
+ int do_local_scale = 0; /* for interlaced 16-to-8 bit conversion */
|
|
int passes = 0;
|
|
|
|
/* Add transforms to ensure the correct output format is produced then check
|
|
@@ -3703,8 +3758,16 @@ png_image_read_direct(png_voidp argument)
|
|
png_set_expand_16(png_ptr);
|
|
|
|
else /* 8-bit output */
|
|
+ {
|
|
png_set_scale_16(png_ptr);
|
|
|
|
+ /* For interlaced images, use local_row buffer to avoid overflow
|
|
+ * in png_combine_row() which writes using IHDR bit-depth.
|
|
+ */
|
|
+ if (png_ptr->interlaced != 0)
|
|
+ do_local_scale = 1;
|
|
+ }
|
|
+
|
|
change &= ~PNG_FORMAT_FLAG_LINEAR;
|
|
}
|
|
|
|
@@ -3980,6 +4043,24 @@ png_image_read_direct(png_voidp argument)
|
|
return result;
|
|
}
|
|
|
|
+ else if (do_local_scale != 0)
|
|
+ {
|
|
+ /* For interlaced 16-to-8 conversion, use an intermediate row buffer
|
|
+ * to avoid buffer overflows in png_combine_row. The local_row is sized
|
|
+ * for the transformed (8-bit) output, preventing the overflow that would
|
|
+ * occur if png_combine_row wrote 16-bit data directly to the user buffer.
|
|
+ */
|
|
+ int result;
|
|
+ png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
|
|
+
|
|
+ display->local_row = row;
|
|
+ result = png_safe_execute(image, png_image_read_direct_scaled, display);
|
|
+ display->local_row = NULL;
|
|
+ png_free(png_ptr, row);
|
|
+
|
|
+ return result;
|
|
+ }
|
|
+
|
|
else
|
|
{
|
|
png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes;
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngrio.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngrio.c
|
|
index 961d010df42..50a424d0912 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngrio.c
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngrio.c
|
|
@@ -29,7 +29,7 @@
|
|
* However, the following notice accompanied the original version of this
|
|
* file and, per its terms, should not be removed:
|
|
*
|
|
- * Copyright (c) 2018 Cosmin Truta
|
|
+ * Copyright (c) 2018-2025 Cosmin Truta
|
|
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
|
|
* Copyright (c) 1996-1997 Andreas Dilger
|
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
|
@@ -85,7 +85,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, size_t length)
|
|
/* fread() returns 0 on error, so it is OK to store this in a size_t
|
|
* instead of an int, which is what fread() actually returns.
|
|
*/
|
|
- check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr));
|
|
+ check = fread(data, 1, length, png_voidcast(FILE *, png_ptr->io_ptr));
|
|
|
|
if (check != length)
|
|
png_error(png_ptr, "Read Error");
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
|
|
index 4f31f8f07bc..a19615f49fe 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
|
|
@@ -29,7 +29,7 @@
|
|
* However, the following notice accompanied the original version of this
|
|
* file and, per its terms, should not be removed:
|
|
*
|
|
- * Copyright (c) 2018-2024 Cosmin Truta
|
|
+ * Copyright (c) 2018-2025 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.
|
|
@@ -57,6 +57,12 @@
|
|
# endif
|
|
#endif
|
|
|
|
+#ifdef PNG_RISCV_RVV_IMPLEMENTATION
|
|
+# if PNG_RISCV_RVV_IMPLEMENTATION == 1
|
|
+# define PNG_RISCV_RVV_INTRINSICS_AVAILABLE
|
|
+# endif
|
|
+#endif
|
|
+
|
|
#ifdef PNG_READ_SUPPORTED
|
|
|
|
/* Set the action on getting a CRC error for an ancillary or critical chunk. */
|
|
@@ -524,9 +530,19 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|
{
|
|
int i;
|
|
|
|
+ /* Initialize the array to index colors.
|
|
+ *
|
|
+ * Ensure quantize_index can fit 256 elements (PNG_MAX_PALETTE_LENGTH)
|
|
+ * rather than num_palette elements. This is to prevent buffer overflows
|
|
+ * caused by malformed PNG files with out-of-range palette indices.
|
|
+ *
|
|
+ * Be careful to avoid leaking memory. Applications are allowed to call
|
|
+ * this function more than once per png_struct.
|
|
+ */
|
|
+ png_free(png_ptr, png_ptr->quantize_index);
|
|
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
|
|
- (png_alloc_size_t)num_palette);
|
|
- for (i = 0; i < num_palette; i++)
|
|
+ PNG_MAX_PALETTE_LENGTH);
|
|
+ for (i = 0; i < PNG_MAX_PALETTE_LENGTH; i++)
|
|
png_ptr->quantize_index[i] = (png_byte)i;
|
|
}
|
|
|
|
@@ -538,15 +554,14 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|
* Perhaps not the best solution, but good enough.
|
|
*/
|
|
|
|
- int i;
|
|
+ png_bytep quantize_sort;
|
|
+ int i, j;
|
|
|
|
- /* Initialize an array to sort colors */
|
|
- png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
|
|
+ /* Initialize the local array to sort colors. */
|
|
+ quantize_sort = (png_bytep)png_malloc(png_ptr,
|
|
(png_alloc_size_t)num_palette);
|
|
-
|
|
- /* Initialize the quantize_sort array */
|
|
for (i = 0; i < num_palette; i++)
|
|
- png_ptr->quantize_sort[i] = (png_byte)i;
|
|
+ quantize_sort[i] = (png_byte)i;
|
|
|
|
/* Find the least used palette entries by starting a
|
|
* bubble sort, and running it until we have sorted
|
|
@@ -558,19 +573,18 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|
for (i = num_palette - 1; i >= maximum_colors; i--)
|
|
{
|
|
int done; /* To stop early if the list is pre-sorted */
|
|
- int j;
|
|
|
|
done = 1;
|
|
for (j = 0; j < i; j++)
|
|
{
|
|
- if (histogram[png_ptr->quantize_sort[j]]
|
|
- < histogram[png_ptr->quantize_sort[j + 1]])
|
|
+ if (histogram[quantize_sort[j]]
|
|
+ < histogram[quantize_sort[j + 1]])
|
|
{
|
|
png_byte t;
|
|
|
|
- t = png_ptr->quantize_sort[j];
|
|
- png_ptr->quantize_sort[j] = png_ptr->quantize_sort[j + 1];
|
|
- png_ptr->quantize_sort[j + 1] = t;
|
|
+ t = quantize_sort[j];
|
|
+ quantize_sort[j] = quantize_sort[j + 1];
|
|
+ quantize_sort[j + 1] = t;
|
|
done = 0;
|
|
}
|
|
}
|
|
@@ -582,18 +596,18 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|
/* Swap the palette around, and set up a table, if necessary */
|
|
if (full_quantize != 0)
|
|
{
|
|
- int j = num_palette;
|
|
+ j = num_palette;
|
|
|
|
/* Put all the useful colors within the max, but don't
|
|
* move the others.
|
|
*/
|
|
for (i = 0; i < maximum_colors; i++)
|
|
{
|
|
- if ((int)png_ptr->quantize_sort[i] >= maximum_colors)
|
|
+ if ((int)quantize_sort[i] >= maximum_colors)
|
|
{
|
|
do
|
|
j--;
|
|
- while ((int)png_ptr->quantize_sort[j] >= maximum_colors);
|
|
+ while ((int)quantize_sort[j] >= maximum_colors);
|
|
|
|
palette[i] = palette[j];
|
|
}
|
|
@@ -601,7 +615,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|
}
|
|
else
|
|
{
|
|
- int j = num_palette;
|
|
+ j = num_palette;
|
|
|
|
/* Move all the used colors inside the max limit, and
|
|
* develop a translation table.
|
|
@@ -609,13 +623,13 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|
for (i = 0; i < maximum_colors; i++)
|
|
{
|
|
/* Only move the colors we need to */
|
|
- if ((int)png_ptr->quantize_sort[i] >= maximum_colors)
|
|
+ if ((int)quantize_sort[i] >= maximum_colors)
|
|
{
|
|
png_color tmp_color;
|
|
|
|
do
|
|
j--;
|
|
- while ((int)png_ptr->quantize_sort[j] >= maximum_colors);
|
|
+ while ((int)quantize_sort[j] >= maximum_colors);
|
|
|
|
tmp_color = palette[j];
|
|
palette[j] = palette[i];
|
|
@@ -653,8 +667,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|
}
|
|
}
|
|
}
|
|
- png_free(png_ptr, png_ptr->quantize_sort);
|
|
- png_ptr->quantize_sort = NULL;
|
|
+ png_free(png_ptr, quantize_sort);
|
|
}
|
|
else
|
|
{
|
|
@@ -1797,19 +1810,51 @@ png_init_read_transformations(png_structrp png_ptr)
|
|
}
|
|
else /* if (png_ptr->trans_alpha[i] != 0xff) */
|
|
{
|
|
- png_byte v, w;
|
|
-
|
|
- v = png_ptr->gamma_to_1[palette[i].red];
|
|
- png_composite(w, v, png_ptr->trans_alpha[i], back_1.red);
|
|
- palette[i].red = png_ptr->gamma_from_1[w];
|
|
-
|
|
- v = png_ptr->gamma_to_1[palette[i].green];
|
|
- png_composite(w, v, png_ptr->trans_alpha[i], back_1.green);
|
|
- palette[i].green = png_ptr->gamma_from_1[w];
|
|
-
|
|
- v = png_ptr->gamma_to_1[palette[i].blue];
|
|
- png_composite(w, v, png_ptr->trans_alpha[i], back_1.blue);
|
|
- palette[i].blue = png_ptr->gamma_from_1[w];
|
|
+ if ((png_ptr->flags & PNG_FLAG_OPTIMIZE_ALPHA) != 0)
|
|
+ {
|
|
+ /* Premultiply only:
|
|
+ * component = round((component * alpha) / 255)
|
|
+ */
|
|
+ png_uint_32 component;
|
|
+
|
|
+ component = png_ptr->gamma_to_1[palette[i].red];
|
|
+ component =
|
|
+ (component * png_ptr->trans_alpha[i] + 128) / 255;
|
|
+ palette[i].red = png_ptr->gamma_from_1[component];
|
|
+
|
|
+ component = png_ptr->gamma_to_1[palette[i].green];
|
|
+ component =
|
|
+ (component * png_ptr->trans_alpha[i] + 128) / 255;
|
|
+ palette[i].green = png_ptr->gamma_from_1[component];
|
|
+
|
|
+ component = png_ptr->gamma_to_1[palette[i].blue];
|
|
+ component =
|
|
+ (component * png_ptr->trans_alpha[i] + 128) / 255;
|
|
+ palette[i].blue = png_ptr->gamma_from_1[component];
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ /* Composite with background color:
|
|
+ * component =
|
|
+ * alpha * component + (1 - alpha) * background
|
|
+ */
|
|
+ png_byte v, w;
|
|
+
|
|
+ v = png_ptr->gamma_to_1[palette[i].red];
|
|
+ png_composite(w, v,
|
|
+ png_ptr->trans_alpha[i], back_1.red);
|
|
+ palette[i].red = png_ptr->gamma_from_1[w];
|
|
+
|
|
+ v = png_ptr->gamma_to_1[palette[i].green];
|
|
+ png_composite(w, v,
|
|
+ png_ptr->trans_alpha[i], back_1.green);
|
|
+ palette[i].green = png_ptr->gamma_from_1[w];
|
|
+
|
|
+ v = png_ptr->gamma_to_1[palette[i].blue];
|
|
+ png_composite(w, v,
|
|
+ png_ptr->trans_alpha[i], back_1.blue);
|
|
+ palette[i].blue = png_ptr->gamma_from_1[w];
|
|
+ }
|
|
}
|
|
}
|
|
else
|
|
@@ -5032,13 +5077,8 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
|
|
|
|
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
|
if ((png_ptr->transformations & PNG_QUANTIZE) != 0)
|
|
- {
|
|
png_do_quantize(row_info, png_ptr->row_buf + 1,
|
|
png_ptr->palette_lookup, png_ptr->quantize_index);
|
|
-
|
|
- if (row_info->rowbytes == 0)
|
|
- png_error(png_ptr, "png_do_quantize returned rowbytes=0");
|
|
- }
|
|
#endif /* READ_QUANTIZE */
|
|
|
|
#ifdef PNG_READ_EXPAND_16_SUPPORTED
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c
|
|
index 6cf466d182a..07d53cb2c76 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c
|
|
@@ -29,7 +29,7 @@
|
|
* However, the following notice accompanied the original version of this
|
|
* file and, per its terms, should not be removed:
|
|
*
|
|
- * Copyright (c) 2018-2024 Cosmin Truta
|
|
+ * Copyright (c) 2018-2025 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.
|
|
@@ -2441,10 +2441,6 @@ png_handle_tEXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|
}
|
|
#endif
|
|
|
|
- /* TODO: this doesn't work and shouldn't be necessary. */
|
|
- if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
|
|
- png_ptr->mode |= PNG_AFTER_IDAT;
|
|
-
|
|
buffer = png_read_buffer(png_ptr, length+1);
|
|
|
|
if (buffer == NULL)
|
|
@@ -2515,10 +2511,6 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|
}
|
|
#endif
|
|
|
|
- /* TODO: should not be necessary. */
|
|
- 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. The limit check in png_handle_chunk should be
|
|
* sufficient.
|
|
@@ -2635,10 +2627,6 @@ png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|
}
|
|
#endif
|
|
|
|
- /* TODO: should not be necessary. */
|
|
- if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
|
|
- png_ptr->mode |= PNG_AFTER_IDAT;
|
|
-
|
|
buffer = png_read_buffer(png_ptr, length+1);
|
|
|
|
if (buffer == NULL)
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c
|
|
index 1bfd292bd46..0b2844f1864 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c
|
|
@@ -329,17 +329,14 @@ png_set_mDCV(png_const_structrp png_ptr, png_inforp info_ptr,
|
|
double maxDL, double minDL)
|
|
{
|
|
png_set_mDCV_fixed(png_ptr, info_ptr,
|
|
- /* The ITU approach is to scale by 50,000, not 100,000 so just divide
|
|
- * the input values by 2 and use png_fixed:
|
|
- */
|
|
- png_fixed(png_ptr, white_x / 2, "png_set_mDCV(white(x))"),
|
|
- png_fixed(png_ptr, white_y / 2, "png_set_mDCV(white(y))"),
|
|
- png_fixed(png_ptr, red_x / 2, "png_set_mDCV(red(x))"),
|
|
- png_fixed(png_ptr, red_y / 2, "png_set_mDCV(red(y))"),
|
|
- png_fixed(png_ptr, green_x / 2, "png_set_mDCV(green(x))"),
|
|
- png_fixed(png_ptr, green_y / 2, "png_set_mDCV(green(y))"),
|
|
- png_fixed(png_ptr, blue_x / 2, "png_set_mDCV(blue(x))"),
|
|
- png_fixed(png_ptr, blue_y / 2, "png_set_mDCV(blue(y))"),
|
|
+ png_fixed(png_ptr, white_x, "png_set_mDCV(white(x))"),
|
|
+ png_fixed(png_ptr, white_y, "png_set_mDCV(white(y))"),
|
|
+ png_fixed(png_ptr, red_x, "png_set_mDCV(red(x))"),
|
|
+ png_fixed(png_ptr, red_y, "png_set_mDCV(red(y))"),
|
|
+ png_fixed(png_ptr, green_x, "png_set_mDCV(green(x))"),
|
|
+ png_fixed(png_ptr, green_y, "png_set_mDCV(green(y))"),
|
|
+ png_fixed(png_ptr, blue_x, "png_set_mDCV(blue(x))"),
|
|
+ png_fixed(png_ptr, blue_y, "png_set_mDCV(blue(y))"),
|
|
png_fixed_ITU(png_ptr, maxDL, "png_set_mDCV(maxDL)"),
|
|
png_fixed_ITU(png_ptr, minDL, "png_set_mDCV(minDL)"));
|
|
}
|
|
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h
|
|
index d6c446564d1..8edb4bc393a 100644
|
|
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h
|
|
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h
|
|
@@ -22,14 +22,14 @@
|
|
* questions.
|
|
*/
|
|
|
|
-/* pngstruct.h - header file for PNG reference library
|
|
+/* pngstruct.h - internal structures for libpng
|
|
*
|
|
* This file is available under and governed by the GNU General Public
|
|
* License version 2 only, as published by the Free Software Foundation.
|
|
* However, the following notice accompanied the original version of this
|
|
* file and, per its terms, should not be removed:
|
|
*
|
|
- * Copyright (c) 2018-2022 Cosmin Truta
|
|
+ * Copyright (c) 2018-2025 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.
|
|
@@ -39,11 +39,9 @@
|
|
* and license in png.h
|
|
*/
|
|
|
|
-/* The structure that holds the information to read and write PNG files.
|
|
- * The only people who need to care about what is inside of this are the
|
|
- * people who will be modifying the library for their own special needs.
|
|
- * It should NOT be accessed directly by an application.
|
|
- */
|
|
+#ifndef PNGPRIV_H
|
|
+# error This file must not be included by applications; please include <png.h>
|
|
+#endif
|
|
|
|
#ifndef PNGSTRUCT_H
|
|
#define PNGSTRUCT_H
|
|
@@ -406,7 +404,8 @@ struct png_struct_def
|
|
|
|
/* New member added in libpng-1.6.36 */
|
|
#if defined(PNG_READ_EXPAND_SUPPORTED) && \
|
|
- defined(PNG_ARM_NEON_IMPLEMENTATION)
|
|
+ (defined(PNG_ARM_NEON_IMPLEMENTATION) || \
|
|
+ defined(PNG_RISCV_RVV_IMPLEMENTATION))
|
|
png_bytep riffled_palette; /* buffer for accelerated palette expansion */
|
|
#endif
|
|
|
|
@@ -435,7 +434,6 @@ struct png_struct_def
|
|
|
|
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
|
/* The following three members were added at version 1.0.14 and 1.2.4 */
|
|
- png_bytep quantize_sort; /* working sort array */
|
|
png_bytep index_to_palette; /* where the original index currently is
|
|
in the palette */
|
|
png_bytep palette_to_index; /* which original index points to this
|