From 46743c1701e427746e8faad9544e18b27b7f40d6 Mon Sep 17 00:00:00 2001 From: Letu Ren Date: Tue, 12 Dec 2023 23:05:02 +0800 Subject: [PATCH] Update 3rdparty libspng to 0.7.4 Include three fixes: https://github.com/randy408/libspng/commit/e68ba5df571726bf001d9ea150980463ea395a75 https://github.com/randy408/libspng/commit/6c7c8ce3729bb866eec9e94e426c3221abf402b0 https://github.com/randy408/libspng/commit/c9451cab664794dc909c4580dd1e6e013f3db512 and three chores: https://github.com/randy408/libspng/commit/d86a11d3ab8f37e7772d52490d3b086d0e0f9bc7 https://github.com/randy408/libspng/commit/bab9f94a1186f8fda234b4e1cb65e1b9a77049cc https://github.com/randy408/libspng/commit/fb768002d4288590083a476af628e51c3f1d47cd I have reviewed CMakeLists.txt and I think disabling unused-variable warning is not needed. --- 3rdparty/libspng/CMakeLists.txt | 1 - 3rdparty/libspng/LICENSE | 2 +- 3rdparty/libspng/spng.c | 8 +++++--- 3rdparty/libspng/spng.h | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/3rdparty/libspng/CMakeLists.txt b/3rdparty/libspng/CMakeLists.txt index afd6d5fe4069..ab0a41a5c619 100644 --- a/3rdparty/libspng/CMakeLists.txt +++ b/3rdparty/libspng/CMakeLists.txt @@ -23,7 +23,6 @@ if(MSVC) endif(MSVC) add_library(${SPNG_LIBRARY} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${spng_headers} ${spng_sources}) -ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-variable) target_link_libraries(${SPNG_LIBRARY} ${ZLIB_LIBRARIES}) set_target_properties(${SPNG_LIBRARY} diff --git a/3rdparty/libspng/LICENSE b/3rdparty/libspng/LICENSE index f96574b80d2a..a29d5a2fa8d4 100644 --- a/3rdparty/libspng/LICENSE +++ b/3rdparty/libspng/LICENSE @@ -1,6 +1,6 @@ BSD 2-Clause License -Copyright (c) 2018-2022, Randy +Copyright (c) 2018-2023, Randy All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/3rdparty/libspng/spng.c b/3rdparty/libspng/spng.c index 6ed60f2d6ce6..b22b7110a17b 100644 --- a/3rdparty/libspng/spng.c +++ b/3rdparty/libspng/spng.c @@ -2691,6 +2691,7 @@ static int read_non_idat_chunks(spng_ctx *ctx) if(!memcmp(chunk.type, type_exif, 4)) { if(ctx->file.exif) return SPNG_EDUP_EXIF; + if(!chunk.length) return SPNG_EEXIF; ctx->file.exif = 1; @@ -4999,11 +5000,11 @@ void spng_ctx_free(spng_ctx *ctx) spng__free(ctx, ctx->prev_scanline_buf); spng__free(ctx, ctx->filtered_scanline_buf); - spng_free_fn *free_func = ctx->alloc.free_fn; + spng_free_fn *free_fn = ctx->alloc.free_fn; memset(ctx, 0, sizeof(spng_ctx)); - free_func(ctx); + free_fn(ctx); } static int buffer_read_fn(spng_ctx *ctx, void *user, void *data, size_t n) @@ -5743,7 +5744,8 @@ int spng_set_iccp(spng_ctx *ctx, struct spng_iccp *iccp) SPNG_SET_CHUNK_BOILERPLATE(iccp); if(check_png_keyword(iccp->profile_name)) return SPNG_EICCP_NAME; - if(!iccp->profile_len || iccp->profile_len > UINT_MAX) return 1; + if(!iccp->profile_len) return SPNG_ECHUNK_SIZE; + if(iccp->profile_len > spng_u32max) return SPNG_ECHUNK_STDLEN; if(ctx->iccp.profile && !ctx->user.iccp) spng__free(ctx, ctx->iccp.profile); diff --git a/3rdparty/libspng/spng.h b/3rdparty/libspng/spng.h index 5937d6c15de3..8f946337bfa2 100644 --- a/3rdparty/libspng/spng.h +++ b/3rdparty/libspng/spng.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (BSD-2-Clause AND libpng-2.0) */ +/* SPDX-License-Identifier: BSD-2-Clause */ #ifndef SPNG_H #define SPNG_H @@ -28,7 +28,7 @@ extern "C" { #define SPNG_VERSION_MAJOR 0 #define SPNG_VERSION_MINOR 7 -#define SPNG_VERSION_PATCH 3 +#define SPNG_VERSION_PATCH 4 enum spng_errno {