From 1288aace987652d6c0d002a9d6fa351b775e225c Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Mon, 8 Dec 2025 10:34:20 +0300 Subject: [PATCH] libpng update to version 1.6.53. --- 3rdparty/libpng/CHANGES | 6 +++ 3rdparty/libpng/README | 2 +- 3rdparty/libpng/png.c | 4 +- 3rdparty/libpng/png.h | 14 +++--- 3rdparty/libpng/pngconf.h | 2 +- 3rdparty/libpng/pngread.c | 2 +- 3rdparty/libpng/riscv/filter_rvv_intrinsics.c | 49 ++----------------- 7 files changed, 23 insertions(+), 56 deletions(-) diff --git a/3rdparty/libpng/CHANGES b/3rdparty/libpng/CHANGES index f8ad74bbdf..ea43101538 100644 --- a/3rdparty/libpng/CHANGES +++ b/3rdparty/libpng/CHANGES @@ -6315,6 +6315,12 @@ Version 1.6.52 [December 3, 2025] Added allocation failure fuzzing to oss-fuzz. (Contributed by Philippe Antoine.) +Version 1.6.53 [December 5, 2025] + Fixed a build failure on RISC-V RVV caused by a misspelled intrinsic. + (Contributed by Alexander Smorkalov.) + Fixed a build failure with CMake 4.1 or newer, on Windows, when using + Visual C++ without MASM installed. + 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/3rdparty/libpng/README b/3rdparty/libpng/README index 87e5f8b177..4041ad86eb 100644 --- a/3rdparty/libpng/README +++ b/3rdparty/libpng/README @@ -1,4 +1,4 @@ -README for libpng version 1.6.52 +README for libpng version 1.6.53 ================================ See the note about version numbers near the top of `png.h`. diff --git a/3rdparty/libpng/png.c b/3rdparty/libpng/png.c index 11b65d1f13..85b4949652 100644 --- a/3rdparty/libpng/png.c +++ b/3rdparty/libpng/png.c @@ -13,7 +13,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_52 Your_png_h_is_not_version_1_6_52; +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 * 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 #else return PNG_STRING_NEWLINE \ - "libpng version 1.6.52" PNG_STRING_NEWLINE \ + "libpng version 1.6.53" 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 \ diff --git a/3rdparty/libpng/png.h b/3rdparty/libpng/png.h index bceb9aa45d..bdcd243dea 100644 --- a/3rdparty/libpng/png.h +++ b/3rdparty/libpng/png.h @@ -1,6 +1,6 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.52 + * libpng version 1.6.53 * * Copyright (c) 2018-2025 Cosmin Truta * 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.97, January 1998, through 1.6.35, July 2018: * Glenn Randers-Pehrson - * libpng versions 1.6.36, December 2018, through 1.6.52, December 2025: + * libpng versions 1.6.36, December 2018, through 1.6.53, December 2025: * Cosmin Truta * See also "Contributing Authors", below. */ @@ -238,7 +238,7 @@ * ... * 1.5.30 15 10530 15.so.15.30[.0] * ... - * 1.6.52 16 10651 16.so.16.52[.0] + * 1.6.53 16 10651 16.so.16.53[.0] * * Henceforth the source version will match the shared-library major and * 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 */ -#define PNG_LIBPNG_VER_STRING "1.6.52" +#define PNG_LIBPNG_VER_STRING "1.6.53" #define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n" /* 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: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 52 +#define PNG_LIBPNG_VER_RELEASE 53 /* This should be zero for a public release, or non-zero for a * development version. @@ -316,7 +316,7 @@ * From version 1.0.1 it is: * XXYYZZ, where XX=major, YY=minor, ZZ=release */ -#define PNG_LIBPNG_VER 10652 /* 1.6.52 */ +#define PNG_LIBPNG_VER 10653 /* 1.6.53 */ /* Library configuration: these options cannot be changed after * 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 * do not agree upon the version number. */ -typedef char* png_libpng_version_1_6_52; +typedef char* png_libpng_version_1_6_53; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * diff --git a/3rdparty/libpng/pngconf.h b/3rdparty/libpng/pngconf.h index 76b5c20bdf..f4ff19209c 100644 --- a/3rdparty/libpng/pngconf.h +++ b/3rdparty/libpng/pngconf.h @@ -1,6 +1,6 @@ /* pngconf.h - machine-configurable file for libpng * - * libpng version 1.6.52 + * libpng version 1.6.53 * * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson diff --git a/3rdparty/libpng/pngread.c b/3rdparty/libpng/pngread.c index f8ca2b7e31..13a93deedc 100644 --- a/3rdparty/libpng/pngread.c +++ b/3rdparty/libpng/pngread.c @@ -3278,7 +3278,7 @@ png_image_read_composite(png_voidp argument) /* Clamp to the valid range to defend against * unforeseen cases where the data might be sRGB * instead of linear premultiplied. - * (Belt-and-suspenders for GitHub Issue #764.) + * (Belt-and-suspenders for CVE-2025-66293.) */ if (component > 255*65535) component = 255*65535; diff --git a/3rdparty/libpng/riscv/filter_rvv_intrinsics.c b/3rdparty/libpng/riscv/filter_rvv_intrinsics.c index 7e61fb89fb..b41cf9d400 100644 --- a/3rdparty/libpng/riscv/filter_rvv_intrinsics.c +++ b/3rdparty/libpng/riscv/filter_rvv_intrinsics.c @@ -2,9 +2,11 @@ * * Copyright (c) 2023 Google LLC * Written by Manfred SCHLAEGL, 2022 - * DragoČ™ Tiselice , May 2023. - * Filip Wasil , March 2025. - * Liang Junzhao , November 2025. + * Revised by: + * - DragoČ™ Tiselice , May 2023 + * - Filip Wasil , March 2025 + * - Liang Junzhao , November 2025 + * - Alexander Smorkalov , December 2025 * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -175,47 +177,6 @@ png_read_filter_row_avg4_rvv(png_row_infop row_info, png_bytep row, PNG_UNUSED(prev_row) } -#define MIN_CHUNK_LEN 256 -#define MAX_CHUNK_LEN 2048 - -static inline vuint8m1_t -prefix_sum(vuint8m1_t chunk, unsigned char* carry, size_t vl, - size_t max_chunk_len) -{ - size_t r; - - for (r = 1; r < MIN_CHUNK_LEN; r <<= 1) - { - vbool8_t shift_mask = __riscv_vmsgeu_vx_u8m1_b8(__riscv_vid_v_u8m1(vl), r, vl); - chunk = __riscv_vadd_vv_u8m1_mu(shift_mask, chunk, chunk, __riscv_vslideup_vx_u8m1(__riscv_vundefined_u8m1(), chunk, r, vl), vl); - } - - for (r = MIN_CHUNK_LEN; r < MAX_CHUNK_LEN && r < max_chunk_len; r <<= 1) - { - vbool8_t shift_mask = __riscv_vmsgeu_vx_u8m1_b8(__riscv_vid_v_u8m1(vl), r, vl); - chunk = __riscv_vadd_vv_u8m1_mu(shift_mask, chunk, chunk, __riscv_vslideup_vx_u8m1(__riscv_vundefined_u8m1(), chunk, r, vl), vl); - } - - chunk = __riscv_vadd_vx_u8m1(chunk, *carry, vl); - *carry = __riscv_vmv_x_s_u8m1_u8(__riscv_vslidedown_vx_u8m1(chunk, vl - 1, vl)); - - return chunk; -} - -static inline vint16m1_t -abs_diff(vuint16m1_t a, vuint16m1_t b, size_t vl) -{ - vint16m1_t diff = __riscv_vreinterpret_v_u16m1_i16m1(__riscv_vsub_vv_u16m1(a, b, vl)); - vbool16_t mask = __riscv_vmslt_vx_i16m1_b16(diff, 0, vl); - return __riscv_vrsub_vx_i16m1_m(mask, diff, 0, vl); -} - -static inline vint16m1_t -abs_sum(vint16m1_t a, vint16m1_t b, size_t vl) -{ - return __riscv_vadd_vv_i16m1(a, b, vl); -} - static inline void png_read_filter_row_paeth_rvv(size_t len, size_t bpp, unsigned char* row, const unsigned char* prev)