Skip to content

Commit

Permalink
Merge tag 'v1.6.47' into libpng18
Browse files Browse the repository at this point in the history
Sync with libpng version 1.6.47
  • Loading branch information
ctruta committed Feb 18, 2025
2 parents 91c396c + 872555f commit d35fa11
Show file tree
Hide file tree
Showing 30 changed files with 2,000 additions and 3,007 deletions.
12 changes: 12 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -6239,6 +6239,18 @@ Version 1.6.46 [January 23, 2025]
Cleaned up contrib/pngminus: corrected an old typo, removed an old
workaround, and updated the CMake file.

Version 1.6.47 [February 18, 2025]
Modified the behaviour of colorspace chunks in order to adhere
to the new precedence rules formulated in the latest draft of
the PNG Specification.
(Contributed by John Bowler)
Fixed a latent bug in `png_write_iCCP`.
This would have been a read-beyond-end-of-malloc vulnerability,
introduced early in the libpng-1.6.0 development, yet (fortunately!)
it was inaccessible before the above-mentioned modification of the
colorspace precedence rules, due to pre-existing colorspace checks.
(Reported by Bob Friesenhahn; fixed by John Bowler)

Version 1.8.0 [TODO]

Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Expand Down
11 changes: 7 additions & 4 deletions ci/ci_verify_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function ci_trace_build {
ci_info "environment option: \$CI_RANLIB: '$CI_RANLIB'"
ci_info "environment option: \$CI_SANITIZERS: '$CI_SANITIZERS'"
ci_info "environment option: \$CI_FORCE: '$CI_FORCE'"
ci_info "environment option: \$CI_NO_BUILD: '$CI_NO_BUILD'"
ci_info "environment option: \$CI_NO_TEST: '$CI_NO_TEST'"
ci_info "environment option: \$CI_NO_INSTALL: '$CI_NO_INSTALL'"
ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
Expand Down Expand Up @@ -148,10 +149,12 @@ function ci_build {
-S . \
-DCMAKE_INSTALL_PREFIX="$CI_INSTALL_DIR" \
"${all_cmake_vars[@]}"
# Spawn "cmake --build ...".
ci_spawn "$CI_CMAKE" --build "$CI_BUILD_DIR" \
--config "$CI_CMAKE_BUILD_TYPE" \
"${all_cmake_build_flags[@]}"
ci_expr $((CI_NO_BUILD)) || {
# Spawn "cmake --build ...".
ci_spawn "$CI_CMAKE" --build "$CI_BUILD_DIR" \
--config "$CI_CMAKE_BUILD_TYPE" \
"${all_cmake_build_flags[@]}"
}
ci_expr $((CI_NO_TEST)) || {
# Spawn "ctest" if testing is not disabled.
ci_spawn pushd "$CI_BUILD_DIR"
Expand Down
7 changes: 5 additions & 2 deletions ci/ci_verify_configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function ci_trace_build {
ci_info "environment option: \$CI_LD_FLAGS: '$CI_LD_FLAGS'"
ci_info "environment option: \$CI_SANITIZERS: '$CI_SANITIZERS'"
ci_info "environment option: \$CI_FORCE: '$CI_FORCE'"
ci_info "environment option: \$CI_NO_BUILD: '$CI_NO_BUILD'"
ci_info "environment option: \$CI_NO_TEST: '$CI_NO_TEST'"
ci_info "environment option: \$CI_NO_INSTALL: '$CI_NO_INSTALL'"
ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
Expand Down Expand Up @@ -131,8 +132,10 @@ function ci_build {
ci_spawn cd "$CI_BUILD_DIR"
# Spawn "configure".
ci_spawn "$CI_SRC_DIR/configure" --prefix="$CI_INSTALL_DIR" $CI_CONFIGURE_FLAGS
# Spawn "make".
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS
ci_expr $((CI_NO_BUILD)) || {
# Spawn "make".
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS
}
ci_expr $((CI_NO_TEST)) || {
# Spawn "make test" if testing is not disabled.
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS test
Expand Down
11 changes: 7 additions & 4 deletions ci/ci_verify_makefiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function ci_trace_build {
ci_info "environment option: \$CI_LIBS: '$CI_LIBS'"
ci_info "environment option: \$CI_SANITIZERS: '$CI_SANITIZERS'"
ci_info "environment option: \$CI_FORCE: '$CI_FORCE'"
ci_info "environment option: \$CI_NO_BUILD: '$CI_NO_BUILD'"
ci_info "environment option: \$CI_NO_TEST: '$CI_NO_TEST'"
ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
ci_info "executable: \$CI_MAKE: $(command -V "$CI_MAKE")"
Expand Down Expand Up @@ -145,10 +146,12 @@ function ci_build {
for my_makefile in $CI_MAKEFILES
do
ci_info "using makefile: $my_makefile"
# Spawn "make".
ci_spawn "$CI_MAKE" -f "$my_makefile" \
"${all_make_flags[@]}" \
"${all_make_vars[@]}"
ci_expr $((CI_NO_BUILD)) || {
# Spawn "make".
ci_spawn "$CI_MAKE" -f "$my_makefile" \
"${all_make_flags[@]}" \
"${all_make_vars[@]}"
}
ci_expr $((CI_NO_TEST)) || {
# Spawn "make test" if testing is not disabled.
ci_spawn "$CI_MAKE" -f "$my_makefile" \
Expand Down
9 changes: 9 additions & 0 deletions ci/lib/ci.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ function ci_spawn {
[[ ${CI_FORCE:-0} == [01] ]] || {
ci_err "bad boolean option: \$CI_FORCE: '$CI_FORCE'"
}
[[ ${CI_NO_BUILD:-0} == [01] ]] || {
ci_err "bad boolean option: \$CI_NO_BUILD: '$CI_NO_BUILD'"
}
[[ ${CI_NO_TEST:-0} == [01] ]] || {
ci_err "bad boolean option: \$CI_NO_TEST: '$CI_NO_TEST'"
}
Expand All @@ -100,3 +103,9 @@ function ci_spawn {
[[ ${CI_NO_CLEAN:-0} == [01] ]] || {
ci_err "bad boolean option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
}
if ci_expr $((CI_NO_BUILD))
then
ci_expr $((CI_NO_TEST && CI_NO_INSTALL)) || {
ci_err "\$CI_NO_BUILD requires \$CI_NO_TEST and \$CI_NO_INSTALL"
}
fi
15 changes: 15 additions & 0 deletions contrib/conftest/fixed.dfa
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# fixed.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
# Usage rights:
# To the extent possible under law, the author has waived all copyright and
# related or neighboring rights to this work. This work is published from:
# United States.
#
# Test the standard libpng configuration without floating point (the internal
# fixed point implementations are used instead).
#
option FLOATING_ARITHMETIC off
option FLOATING_POINT off
14 changes: 14 additions & 0 deletions contrib/conftest/float-fixed.dfa
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# fixed-float.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
# Usage rights:
# To the extent possible under law, the author has waived all copyright and
# related or neighboring rights to this work. This work is published from:
# United States.
#
# Test the standard libpng configuration with the fixed point internal
# implementation in place of the default floating point
#
option FLOATING_ARITHMETIC off
21 changes: 21 additions & 0 deletions contrib/conftest/nocompile-limits.dfa
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# nolimits.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
#
# Usage rights:
# To the extent possible under law, the author has waived all copyright and
# related or neighboring rights to this work. This work is published from:
# United States.
#
# Build libpng without any limits and without run-time settable limits. Turning
# USER_LIMITS off reduces libpng code size by allowing compile-time elimination
# of some checking code.
#
option USER_LIMITS off

@# define PNG_USER_WIDTH_MAX PNG_UINT_31_MAX
@# define PNG_USER_HEIGHT_MAX PNG_UINT_31_MAX
@# define PNG_USER_CHUNK_CACHE_MAX 0
@# define PNG_USER_CHUNK_MALLOC_MAX 0
19 changes: 19 additions & 0 deletions contrib/conftest/nolimits.dfa
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# nolimits.dfa
# Build time configuration of libpng
#
# Author: John Bowler
# Copyright: (c) John Bowler, 2025
#
# Usage rights:
# To the extent possible under law, the author has waived all copyright and
# related or neighboring rights to this work. This work is published from:
# United States.
#
# Build libpng without any limits. With these settigs run-time limits are still
# possible.
#
@# define PNG_USER_WIDTH_MAX PNG_UINT_31_MAX
@# define PNG_USER_HEIGHT_MAX PNG_UINT_31_MAX
@# define PNG_USER_CHUNK_CACHE_MAX 0
@# define PNG_USER_CHUNK_MALLOC_MAX 0

19 changes: 14 additions & 5 deletions contrib/libtests/pngimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ typedef enum
struct display
{
jmp_buf error_return; /* Where to go to on error */
error_level error_code; /* Set before longjmp */

const char *filename; /* The name of the original file */
const char *operation; /* Operation being performed */
Expand Down Expand Up @@ -760,7 +761,10 @@ display_log(struct display *dp, error_level level, const char *fmt, ...)

/* Errors cause this routine to exit to the fail code */
if (level > APP_FAIL || (level > ERRORS && !(dp->options & CONTINUE)))
{
dp->error_code = level;
longjmp(dp->error_return, level);
}
}

/* error handler callbacks for libpng */
Expand Down Expand Up @@ -1568,18 +1572,19 @@ static int
do_test(struct display *dp, const char *file)
/* Exists solely to isolate the setjmp clobbers */
{
int ret = setjmp(dp->error_return);
dp->error_code = VERBOSE; /* The "lowest" level */

if (ret == 0)
if (setjmp(dp->error_return) == 0)
{
test_one_file(dp, file);
return 0;
}

else if (ret < ERRORS) /* shouldn't longjmp on warnings */
display_log(dp, INTERNAL_ERROR, "unexpected return code %d", ret);
else if (dp->error_code < ERRORS) /* shouldn't longjmp on warnings */
display_log(dp, INTERNAL_ERROR, "unexpected return code %d",
dp->error_code);

return ret;
return dp->error_code;
}

int
Expand Down Expand Up @@ -1679,7 +1684,11 @@ main(int argc, char **argv)
int ret = do_test(&d, argv[i]);

if (ret > QUIET) /* abort on user or internal error */
{
display_clean(&d);
display_destroy(&d);
return 99;
}
}

/* Here on any return, including failures, except user/internal issues
Expand Down
2 changes: 1 addition & 1 deletion manuals/libpng-manual.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ libpng-manual.txt - A description on how to use and modify libpng

Based on:

libpng version 1.6.36, December 2018, through 1.6.46 - January 2025
libpng version 1.6.36, December 2018, through 1.6.47 - February 2025
Updated and distributed by Cosmin Truta
Copyright (c) 2018-2025 Cosmin Truta

Expand Down
6 changes: 3 additions & 3 deletions manuals/libpng.3
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH LIBPNG 3 "January 23, 2025"
.TH LIBPNG 3 "February 18, 2025"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.46
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.47

.SH SYNOPSIS
\fB#include <png.h>\fP
Expand Down Expand Up @@ -518,7 +518,7 @@ libpng-manual.txt - A description on how to use and modify libpng

Based on:

libpng version 1.6.36, December 2018, through 1.6.46 - January 2025
libpng version 1.6.36, December 2018, through 1.6.47 - February 2025
Updated and distributed by Cosmin Truta
Copyright (c) 2018-2025 Cosmin Truta

Expand Down
6 changes: 3 additions & 3 deletions manuals/png.5
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH PNG 5 "January 23, 2025"
.TH PNG 5 "February 18, 2025"
.SH NAME
png \- Portable Network Graphics (PNG) format

Expand All @@ -20,10 +20,10 @@ matching on heterogeneous platforms.
.SH "SEE ALSO"
.BR "libpng"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
.LP
PNG Specification (Third Edition) Candidate Recommendation Draft, July 2024:
PNG Specification (Third Edition) Candidate Recommendation Draft, January 2025:
.IP
.br
https://www.w3.org/TR/2024/CRD-png-3-20240718/
https://www.w3.org/TR/2025/CRD-png-3-20250121/
.LP
PNG Specification (Second Edition), November 2003:
.IP
Expand Down
Loading

0 comments on commit d35fa11

Please sign in to comment.