4333 Commits

Author SHA1 Message Date
Cosmin Truta
f5e92d7697 Release libpng version 1.6.44 v1.6.44 2024-09-12 23:44:44 +03:00
Cosmin Truta
88ab4f592d chore: Rerun ./autogen.sh --maintainer 2024-09-12 21:44:11 +03:00
Cosmin Truta
3117b5f94a oss-fuzz: Update the README file, the Docker file and the build script 2024-09-12 18:26:10 +03:00
John Bowler
5a7e87fc04 fix: Prevent overflow in chromaticity calculations
In `png_xy_from_XYZ` X+Y+Z was calculated without checking for overflow.
This fixes that by moving the correct code from `png_XYZ_normalize` into
a static function which is now used from `png_xy_from_XYZ`.

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-12 12:14:01 +03:00
Green Sky
8cc22a8c15 cmake: Fix an error in the declaration of target include directories
Properly declare target include directories for generated includes.
Previously the non targeted `include_directories()` was used, which
had issue when using the `png_static` target in a submodule.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-10 23:50:55 +03:00
Cosmin Truta
843dbb7579 Revert "cmake: Fix an error in the declaration of target include directories"
This reverts commit 1d1cc9ae18f677201bf7e47928c30562df967756.

The verification has failed. (Oopsie!)
2024-09-10 22:41:03 +03:00
Green Sky
1d1cc9ae18 cmake: Fix an error in the declaration of target include directories
Properly declare target include directories for generated includes.
Previously the non targeted `include_directories()` was used, which
had issue when using the `png_static` target in a submodule.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-10 22:03:13 +03:00
Cosmin Truta
1964d560e9 Deprecate PNGARG and remove all of its remaining uses 2024-09-10 19:15:13 +03:00
Mikhail Khachayants
68ba4f1f7d oss-fuzz: Add fuzzing targets for simplified READ API
New target added to libpng_read_fuzzer.cc for simplified READ API.
2024-09-09 23:45:06 +03:00
Benjamin Buch
0e204b7364 build: Add a CMake config file compatible with the FindPNG module
Co-authored-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-08 21:57:37 +03:00
Cosmin Truta
53a7f4e320 ci: Simplify the Travis CI configuration matrix
Going forward, we will continue to verify the cmake build and the
configure build with the hardware optimizations enabled by default,
and the makefile build with the hardware optimizations disabled by
default.

The Travis CI configuration file is simpler, and, more importantly,
the Travis CI verification process will be shorter and cheaper.
2024-09-08 15:58:08 +03:00
Cosmin Truta
fcdec9c66e chore: Delete contrib/tools/chkfmt.sh
Going forward, we will continue developing and using ci/ci_lint.sh
2024-09-08 15:35:10 +03:00
Cosmin Truta
222086586b chore: Pacify editorconfig-checker version 3.0 2024-09-08 15:22:58 +03:00
Ben Wagner
40878fd6dc fix: Restore STDERR in pngtest.c
In "test: Add consistency checks for the PNG_LIBPNG_VER* number" [0] the
`STDERR` macro was moved from outside an `ifdef` to inside an `ifdef`.
This broke the code in the `else` of this `ifdef` which also uses the
`STDERR` macro. Move `STDERR` back to where it was to avoid compile
errors in the `else` case.

[0] cc8006c48d

Fixes: #560
Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-08 10:47:44 +03:00
John Bowler
20f819c29e fix: Remove cHRM check to accomodate ACES AP1
ACES AP1 has a red endpoint with a negative Z, this triggers the checks
in libpng that ensure that x, y and z (chromaticities) are all >=0.
This removes the checks on the sign of the chromaticities since it is
valid to use negative values for any of them and converts the "internal"
error code return to external (because the internal cases correspond to
negative x, y or z.)

Reviewed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: John Bowler <jbowler@acm.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-07 13:07:21 +03:00
Cosmin Truta
7e18d14296 ci: Add the targets/ subdirectory to facilitate cross-platform testing
Considering that a non-trivial amount of libpng code is arch-specific,
we should perform cross-platform builds (with cross-platform toolchains)
and test runs (on emulated architectures) in our routine verification.

The content of ci/targets/ shall consist of target description files,
written in the standard shell language. These files may be source'd as
needed, before running the verification scripts ci/ci_verify_*.sh.

Here is the initial list of target systems:
Android, Cygwin, FreeBSD, Linux, MSDOS, Windows.

And here is the initial list of target architectures:
ARM, MIPS, PowerPC, RISC-V, x86.
2024-09-05 22:23:30 +03:00
Eric Riff
43d6ad3e15 cmake: Honor CMAKE_SYSROOT if set
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-09-05 18:35:46 +03:00
Cosmin Truta
33ef48b6d6 cmake: Fix the handling of PNG_HARDWARE_OPTIMIZATIONS on FreeBSD/amd64
Because of a missing "amd64" string (in lowercase) in a regex match,
the CMake build was unable to pick up the PNG_HARDWARE_OPTIMIZATIONS
flag on FreeBSD/amd64 (and possibly other amd64 systems as well).

Rename the target arch variable from TARGET_ARCH to a more idiomatic
PNG_TARGET_ARCHITECTURE, and set it to an always-lowercase string.
The follow-on checks are now simpler and easier to get right.
2024-09-04 18:32:03 +03:00
Cosmin Truta
532fec0214 ci: Fix the verification of the msys2 toolchain on AppVeyor CI
Initialize the arch-specific MSYSTEM environment variable, to ensure
that msys2 bash picks up and executes /etc/profile correctly.

Install and use the host-specific cmake and ninja, to ensure that
msys2 cmake picks up the host-specific zlib build correctly.
2024-09-03 14:48:50 +03:00
Cosmin Truta
e4a31f024b arm: Add a placeholder file in lieu of the former filter_neon.S
In the previous commit 9e538750d99c8f1accf7e93878e4fde47c069908
we removed the obsolete assembler implementation `filter_neon.S`.

In this commit we add a stand-in for the original file, restoring
the original source tree structure, for the benefit of continuing
hassle-free libpng source upgrades in the 1.6.x line.
2024-06-17 15:28:38 +03:00
Ross Burton
9e538750d9 arm: Remove obsolete assembler implementation filter_neon.S
This file contains hand-coded assembler implementations of the filter
functions for 32-bit Arm platforms.  These are only used when the
compiler doesn't support neon intrinsics (added to GCC 4.3 in 2008) or
is exactly GCC 4.5.4 (released 2012), both of which are sufficiently
unlikely to be true that it's fair to say the assembler is no longer
used.

This commit deletes filter_neon.S and removes the now obsolete
preprocessor logic in pngpriv.h.

Signed-off-by: Bill Roberts <bill.roberts@arm.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-06-15 23:09:34 +03:00
John Bowler
ceed2a3cf6 SECURITY: disable build of filter_neon.S on arm
This fixes the bug https://github.com/pnggroup/libpng/issues/505
"libpng does not support PAC/BTI on aarch64 targets" which arises
because the build mechanisms (both cmake and configure) assemble
arm/filter_neon.S even though it ends up completely empty.  The empty
file effectively poisons the so that the PAC/BTI support gets disabled.

The fix is minimal; it simply removes arm/filter_neon.S from the list of
sources included in the 64-bit ARM builds build.  Note that this was
already done in cmake for MSVC - it's not clear whether this change was
a partial fix for the same issue.

This version of the fix ONLY affects aarch64 (arm64) builds; 32-bit ARM
systems can still invoke the assembler if required and, indeed, there
should be no change whatsover to those builds.

The assembler code could not be used on 64-bit systems in any case so
in practice there is no material change to 64-bit builds either.

TESTING: pull the changes then type "autoreconf" if using configure (not
required for cmake).

TESTS: cmake has not been tested because cross-builds with cmake
currently fail to find the zlib installation from the cmake system root
path.  The following has been tested with configure cross builds:

armv7-linux-gnueabi [no neon support]
armv7a-linux-gnueabi [no neon support]
armv7a-hardfloat-linux-gnueabi [neon support not enabled]
armv7a-hardfloat-linux-gnueabi -mfpu=neon [uses intrinics]
armv7a-hardfloat-linux-gnueabi -mfpu=neon
        -DPNG_ARM_NEON_IMPLEMENTATION=2 [uses assembler]
aarch64-linux-gnu [uses intrinsics]
aarch64-linux-gnu -DPNG_ARM_NEON_OPT=0 [neon support disabled]

Signed-off-by: John Bowler <jbowler@acm.org>
2024-05-31 10:18:28 -07:00
Cosmin Truta
f1848a3b56 Bump version to 1.6.44.git 2024-02-24 13:32:56 +02:00
Cosmin Truta
ed217e3e60 Release libpng version 1.6.43 v1.6.43 2024-02-23 11:51:40 +02:00
Cosmin Truta
e1fa61daa8 ci: Add the libpng release tags to the list of exclusions
The release tags are redundant in the CI process. It is the main branch
that is always verified.
2024-02-23 11:12:03 +02:00
Cosmin Truta
80691b9da2 test: Fix a compiler warning in pngtest.c 2024-02-23 11:09:51 +02:00
Cosmin Truta
890231026d chore: Delete comments and config settings and stuff from here and there 2024-02-22 17:00:05 +02:00
Cosmin Truta
3b9a73ed3e doc: Review the libpng history and update scripts/cmake/AUTHORS.md 2024-02-22 16:47:51 +02:00
Cosmin Truta
e05ebfba7c doc: Update the README file 2024-02-22 12:30:50 +02:00
Cosmin Truta
ec2e58c16a pngexif: Import pngexifinfo as an externally-contributed project
We used this experimental project in the development of the PNG-EXIF
("eXIf") specification, back in 2017. The project evolved together
with the draft specification, which was finalized on 2017-Jun-15 and
approved by the PNG Group on 2017-Jul-13.

The EXIF specification, outside of the scope of PNG and libpng, is
quite complex. The libpng implementation cannot grow too much beyond
performing basic integrity checks on top of serialization. In order
to create and manipulate PNG-EXIF image files, the use of external
libraries and tools such as ExifTool is necessary.

Now, with the addition of contrib/pngexif to the libpng repository,
offline tasks like metadata inspection and linting can be performed
without importing external dependencies.
2024-02-22 11:32:53 +02:00
Benjamin Buch
7b888092b9 build: Mark the installed libpng headers as system headers in CMake
Modern compilers can disable the warnings that originate from system
headers. This change allows them to do so with the libpng headers.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-02-21 23:26:07 +02:00
Cosmin Truta
14a348ddc8 build: Checking for compiler support of LoongArch LSX should be guarded
In the configure script, checking whether the LoongArch LSX intrinsics
are supported by the compiler was done unconditionally, regardless of
the targetted host platform. Compared to how we support the other SIMD
platforms and compilers, this is rather unconventional.

We are placing this check under the guard of its own platform, for the
time being. A full solution, in line with the rest of the configure.ac
patterns concering SIMD optimizations, is TODO.

We also do an overall cleanup in the SIMD section of configure.ac, and,
finally, we regenerate the configure script.
2024-02-20 23:30:12 +02:00
Cosmin Truta
29e31f622f build: Add an explicit declaration of the AWK variable to configure.ac
Declare AWK explicitly via the AC_ARG_VAR directive, in order to make
it "precious", and to include it in the list of influential variables
at the end of the configure help text.

Rephrase a few comments and config traces.

Finally, regenerate the configure script.
2024-02-20 15:10:12 +02:00
Cosmin Truta
d165a20ae4 build: Improve the search for an AWK processor in the CMake build
Add nawk to the list of AWK-processing programs that are known to work,
and show the search result in the CMake log.
2024-02-19 20:51:26 +02:00
Cosmin Truta
aa95dee697 build: Update the CMake build options PNG_TOOLS and PNG_FRAMEWORK
Update the PNG_TOOLS option: set it to OFF by default when the
target is an embedded system, yet still allow it to be overridden.

Update the PNG_FRAMEWORK option: force it back to OFF and print a
warning if the option was ON but the target is not an Apple system.
2024-02-19 14:25:55 +02:00
Dan Rosser
e7ba9c0dfc build: Fix a CMake build regression introduced in version 1.6.41
This fixes commit 4edbb4da81626a7342a22824d7a8f60a3ea71bd0.

During the move of CMake scripts to the scripts/cmake/ subdirectory,
some of the workflows have been broken.

Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2024-02-19 11:19:52 +02:00
Cosmin Truta
6b5a2da072 Fix "ci: Fix the reporting in ci_lint.sh"
This fixes commit dddaf0c625a8daea4d027cb57380b7fac6f58285.

The way to reliably `find` executable files is different on BSD, Mac
and Linux, unfortunately.
2024-02-17 18:28:01 +02:00
Cosmin Truta
dddaf0c625 ci: Fix the reporting in ci_lint.sh
The variable `CI_LINT_COUNTER` was incremented inside subshells, but
remained unchanged in the main shell process. The errors detected by
the internal linters remained unreported by the main script. (Oopsie!)

Besides fixing this defect, considering that only a pass/fail status
is needed, we are replacing `CI_LINT_COUNTER` with `CI_LINT_STATUS`.
2024-02-17 16:32:21 +02:00
Cosmin Truta
72c4520d3c ci: Allow the user to force an in-tree cleanup before verification
Introduce the environment option CI_FORCE:
 * ci_verify_configure.sh is known to fail if an existing build
   configuration is found in the top-level directory.
   Setting CI_FORCE=1 will run `make distclean` before verification.
 * ci_verify_makefiles.sh cannot be reliably executed if random
   object files are found in the top-level directory.
   Setting CI_FORCE=1 will run `rm *.o *.obj` before verification.
 * ci_verify_cmake.sh is not known at this time to fail for similar
   reasons; but if it does, we will use CI_FORCE to trigger any
   necessary pre-build cleanup.
2024-02-17 11:56:35 +02:00
Cosmin Truta
0fa3c0f698 chore: Clean up the spurious uses of sizeof(png_byte); fix the manual
By definition, `sizeof(png_byte)` is 1.

Remove all the occurences of `sizeof(png_byte)` from the code, and fix
a related typo in the libpng manual.

Also update the main .editorconfig file to reflect the fixing expected
by a FIXME note.
2024-02-15 21:53:24 +02:00
Cosmin Truta
4191872d0d chore: Update the .editorconfig files and pacify editorconfig-checker 2024-02-15 18:29:26 +02:00
Cosmin Truta
42c8fcbff9 Add a GitHub Action for linting 2024-02-15 15:43:54 +02:00
Cosmin Truta
f74d5ecce8 ci: Pacify shellcheck version 0.8 and apply other linting improvements
Work around a limitation in the `shellcheck source` directive, which
does not recognize quotes in shellcheck versions older than 0.9.

Also extend the checks for YAML files over the entire source tree, in
preparation for the introduction of the GitHub Actions config file.
2024-02-15 14:37:24 +02:00
Cosmin Truta
fb65436e06 ci: Fix the check of PNG_LIBPNG_VER_BUILD in ci_verify_version.sh
`PNG_LIBPNG_VER_BUILD` should be zero for public releases and non-zero
for development versions. The ci_verify_version.sh script should check
this requirement as such.
2024-02-12 12:22:43 +02:00
Cosmin Truta
63c715b7d7 ci: Remove the workaround for CI_AR from ci_verify_makefiles.sh 2024-02-11 23:49:08 +02:00
Cosmin Truta
1cdde11877 build: Update the makefiles for the benefit of cross-compilation
Split AR_RC into AR and ARFLAGS. The variables AR and ARFLAGS are
de-facto standards (like CC and CFLAGS, LD and LDFLAGS, etc.) that
may be overridden when running make. Moreover, configuring CC, LD,
AR, etc., to point to a cross-platform compiler, linker, librarian,
etc., is a de-facto standard practice as well.

Also remove the MKDIR_P variable definitions from all makefiles.
They've been leftovers from the removal of the "install*" targets.
2024-02-11 23:14:09 +02:00
Cosmin Truta
8120345c89 ci: Update (again) the ci_verify_*.sh scripts; update .shellcheckrc
Apply stylistic improvements and remove a shellcheck exclusion.
2024-02-11 15:24:03 +02:00
Cosmin Truta
7a6148290f ci: Update the ci_verify_*.sh scripts.
Bring the coding patterns in line with the newest scripts.
2024-02-10 16:45:26 +02:00
Cosmin Truta
c6ee62af2e ci: Add ci_verify_version.sh
This program verifies the libpng source tree, expecting consistent
definitions of version numbers in the C source code, in the Autoconf
scripts, and in the CMake scripts.

The version verification is performed as follows. (Please note that
the version definitions in png.h are checked twice.)
 * The files png.h, configure.ac and CMakeLists.txt are checked by
   the ci_verify_version.sh program.
 * The files png.h, png.c and pngtest.c are checked by the pngtest
   program.
2024-02-09 18:00:24 +02:00
Cosmin Truta
46b79d4716 ci: Update and rename ci_lint_ci.sh to ci_lint.sh; update .shellcheckrc
The ci_lint.sh program can now lint the entire libpng source tree.
2024-02-08 21:37:42 +02:00