Commit Graph

4071 Commits

Author SHA1 Message Date
Cosmin Truta
b9155ce3fd scripts: Add general-purpose utilities for continuous integration
Currently, libpng supports three different types of build automation:
the GNU autotools, CMake, and a legacy of hand-made makefiles.

In order to simplify the continous integration of all of the above
build options, we introduce the following scripts:
 * ci_autotools.sh: CI utility for the Autotools build
 * ci_cmake.sh: CI utility for the CMake build
 * ci_legacy.sh: CI utility for the legacy makefiles
2020-03-29 00:41:33 -04:00
Cosmin Truta
2c0aee56a0 Update the copyright year 2020-02-02 20:02:00 -05:00
Christopher Thompson
301f7a1429 oss-fuzz: Add custom malloc with max limit to prevent OOM
This adds the custom malloc/free functions from the old
libpng_read_fuzzer to the upstream fuzzer to prevent clusterfuzz
running into OOM.

Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=904054
Contributed-by: Christopher Thompson <cthomp@chromium.org>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2019-04-25 00:37:57 -04:00
Ryan VanderMeulen
386707c6d1 arm: Use <arm_neon.h> when compiling aarch64 intrinsics with clang-cl
MSVC's <arm64_neon.h> header contains cl.exe intrinsics that are not
recognized by clang-cl.

Contributed-by: Ryan VanderMeulen <rvandermeulen@mozilla.com>
Contributed-by: Mike Klein <mtklein@google.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2019-04-24 23:57:14 -04:00
Cosmin Truta
216387f6f7 arm: Move a png_debug statement to its correct place
It should be placed immediately after all variable declarations.
2019-04-22 23:56:57 -04:00
Cosmin Truta
b9e811fa99 scripts: Delete makefile.clang-asan and makefile.gcc-asan
Travis CI is now running sanitizer-enabled test jobs.
2019-04-22 23:00:58 -04:00
Cosmin Truta
cdbb8ec7aa Add support for Travis CI 2019-04-22 23:00:58 -04:00
Cosmin Truta
72fa126446 Avoid random test failures by running pngtest sequentially only
It is unreliable to run pngtest in parallel, due to competing writes
to the same intermediate/output file ("pngout.png").

Customization of this output file name should be possible, but it is
currently broken.
2019-04-21 00:30:14 -04:00
Cosmin Truta
5df8e982e2 Bump version to 1.6.38.git 2019-04-14 14:10:32 -04:00
Cosmin Truta
a40189cf88 Release libpng version 1.6.37 2019-04-14 14:10:32 -04:00
Miguel Ojeda
8da8257d0b Fix typo in the new v2 license
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2019-04-14 11:15:51 -04:00
Cosmin Truta
27e8b99287 pngminus: Use the system zlib by default
If a zlib source tree exists besides the libpng source tree in the
same parent directory, the pngminus build may fail, unless the zlib
tree is built fully. In order to avoid this failing scenario, do not
use the custom-built zlib by default.

(The custom-built zlib is still necessary on platforms that lack a
system-built zlib.)
2019-04-10 22:23:25 -04:00
Willem van Schaik
62a56d4fcc pngminus: Change license to MIT, etc.
Change the license to MIT.
Move the license text from the source files to a LICENSE file.
Move the change log from the source files to a CHANGES file.
Delete the Turbo C makefile and simplify the Linux makefile heavily.
Create explicitly named static and shared executables in the makefile.
Refresh the README file a bit from the twenty year old one.

Signed-off-by: Willem van Schaik <willem@schaik.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2019-04-10 22:23:25 -04:00
Cosmin Truta
3342fafa60 pngminus: Add a CMakeLists file 2019-04-10 22:23:25 -04:00
Cosmin Truta
3f0f1d5579 pngminus: Improve portability and fix style (cont'd) 2019-04-10 22:23:25 -04:00
Cosmin Truta
dcefbc7dcd pngminus: Improve portability and fix style 2019-04-10 22:23:25 -04:00
Cosmin Truta
1f0221fad7 pngminus: Fix a buffer overflow in tokenizer 2019-04-10 22:23:25 -04:00
Cosmin Truta
a627bd26a3 arm: Partially revert "Fix a memory leak in the riffled palette [...]"
The memory leak remains fixed, but the associated refactoring is
being reverted. Moving the initialization of the riffled palette
from png_do_read_transformations to png_init_palette_transformations
has caused a regression in some of the test programs.

Although png_init_palette_transformations is the proper place to
perform this initialization, and the test programs are technically
incorrect to fail, we are still undoing that refactoring for the
time being.
2019-04-07 19:50:12 -04:00
Cosmin Truta
82ae623ec9 arm: Rename all functions to the pattern png_*_neon; add debug traces 2019-03-31 09:44:45 -04:00
Cosmin Truta
9c0d5c77bf Call png_image_free_function without guarding it with png_safe_execute
png_image_free_function (or any other destructor) should never fail.
Destructors need not and must not be executed under png_safe_execute.

Reference: CVE-2019-7317, use-after-free in png_image_free
2019-02-03 22:40:56 -05:00
Cosmin Truta
8439534daa Fix a memory leak in pngtest.c
Ensure that row_buf is deallocated not only after a read error, but
also after a write error.

Use the format "%p" instead of "0x%08lx" for printf-ing row_buf in
a portable manner.
2019-02-03 21:00:49 -05:00
Cosmin Truta
70d122aac4 Fix a memory leak in the riffled palette optimization on ARM; refactor
Move deallocation of riffled_palette from png_write_destroy to
png_read_destroy. The reader (not the writer) is the owner of
riffled_palette.

Move allocation and initialization of riffled_palette from
png_do_read_transformations to png_init_palette_transformations.

Allow riffled_palette inside png_struct only if the ARM Neon
optimizations are enabled.

Rename png_riffle_palette_rgba to png_riffle_palette_rgba8, etc.,
to better indicate the strict applicability of these routines.

Fix an unused parameter warning in the build configurations where
riffled palette optimization is not enabled.

Fix indentation.
2019-02-03 19:51:18 -05:00
Cosmin Truta
0a882b5787 scripts: Add makefile.clang, makefile.clang-asan and makefile.gcc-asan
Also apply minor updates to makefile.gcc and makefile.msys
2019-01-20 22:21:48 -05:00
Cosmin Truta
fef895aa28 Update the copyright year 2019-01-19 19:01:19 -05:00
Cosmin Truta
43b4141839 scripts: Delete makefile.ne12bsd; clean up makefile.*bsd 2018-12-30 13:34:15 -05:00
Cosmin Truta
6a94d14567 Bump version to 1.6.37.git 2018-12-30 12:00:41 -05:00
Cosmin Truta
0e13545712 Join the branches 'libpng16' and 'master'
The branch 'libpng16' is for tracking libpng version 1.6.x.
The branch 'master' is for tracking the latest stable libpng version.

These branches will diverge again at the next major libpng upgrade.
2018-12-01 09:36:00 -05:00
Cosmin Truta
eddf902320 Release libpng version 1.6.36 2018-12-01 09:36:00 -05:00
Cosmin Truta
85acd919b9 [master] Imported from libpng-1.6.36.tar 2018-12-01 09:36:00 -05:00
Cosmin Truta
e79085a172 Introduce the PNG Reference Library License version 2
The new libpng license comprises the terms and conditions from the zlib
license, and the disclaimer from the Boost license.

The legacy libpng license, used until libpng-1.6.35, is appended to the
new license, following the precedent established in the Python Software
Foundation License version 2.

From now on, the list of contributing authors shall be maintained in a
separate AUTHORS file.

The lists of previous contributing authors, mentioned in the legacy
libpng license and considered to be an integral part of that license,
are kept intact, with no further updates.
2018-11-25 23:33:30 -05:00
Cosmin Truta
81a65de25d Clean up config, scripts, examples, etc. 2018-11-25 20:27:04 -05:00
Kyle Bentley
702a07e716 CMakeLists: Fix incorrect creation of pkg-config file
(Contributed by Kyle Bentley)
2018-11-23 18:58:18 +00:00
Cosmin Truta
7b2224cb6e CMakeLists: Require CMake version 3.1 or newer
Although CMake version 3.0.2 was previously required, the policies
CMP0053 and CMP0054, introduced only in CMake version 3.1 and used
in this CMakeLists file, can have surprising effects under an older
CMake version.

Simplify the CMakeLists file by setting the global policy version
to 3.1, and remove the specific policy settings.

As an added bonus, remove the vestigial workarounds for all ancient
CMake versions.
2018-11-17 23:39:15 -05:00
Cosmin Truta
ee7967eea4 CMakeLists: Fix detection of libm
Only use libm on Unix and Unix-like systems, except for Apple (where
it's unnecessary), and BeOS and Haiku (where it's unavailable).

Avoid searching for libm at explicit locations. They may be incorrect,
especially for cross-platform builds.
2018-11-17 21:31:55 -05:00
Cosmin Truta
a54a0562c5 Rerun autogen.sh 2018-09-04 01:10:21 -04:00
Cosmin Truta
94429a335b Remove the "last changed" version information from source comments 2018-09-04 00:58:55 -04:00
Cosmin Truta
1ceaa83a84 Fix the build with MSVC ARM64 2018-09-04 00:53:38 -04:00
Cosmin Truta
b66ed71131 Restore the ANSI C compliance after adding the ARM optimization
Also apply style and formatting fixes
2018-09-04 00:15:30 -04:00
Richard Townsend
7734cda20c Optimize png_do_expand_palette for ARM
ARM-specific optimization processes 8 or 4 pixels at once.
Improves performance by around 10-22% on a recent ARM Chromebook.
2018-09-04 00:04:58 -04:00
Cosmin Truta
2fc5ddff18 Restore the ANSI C compliance after applying the MSVC ARM64 fix 2018-09-03 22:27:45 -04:00
zzzzRuby
8033c96f32 Fix build errors with MSVC ARM64
(Contributed by Zhijie Liang)
2018-09-03 22:26:06 -04:00
Samuel Williams
d3d1baadb4 Prefer memcpy to manual pointer arithmetic. 2018-08-19 01:16:22 -04:00
luz.paz
a294c1bcb6 Some more trivial source typos
Found via `codespell` and `grep`
2018-08-19 00:57:20 -04:00
Cosmin Truta
ceb327789b Remove top-level const from function-scope variables
As per the const correctness rules, top-level const-ness of data
in automatic scopes does not propagate outside of these scopes
(unlike const-ness at lower levels, such as pointers to const data).

Previously, const was used liberally, but inconsistently across the
libpng codebase. Using const wherever applicable is not incorrect.
However, _consistent_ use of const is difficult to maintain in such
conditions.

In conclusion, we shall continue to use const only where doing so is
strictly necessary:

1. If a function guarantees that it will not modify an argument
   passed by pointer, the corresponding function parameter should be
   a pointer-to-const (const T *).

2. Static data should not be modified, therefore it should be const.

Reference:
Google C++ Style Guide
https://google.github.io/styleguide/cppguide.html#Use_of_const
2018-08-18 22:47:16 -04:00
Cosmin Truta
1ef8882814 Replace the remaining uses of PNG_CONST with const
In v1.6.0, compiler support for const became a requirement.
It should be used consistently. To maintain backwards compatibility,
PNG_CONST is still maintained in deprecated form.
2018-08-18 21:01:02 -04:00
Cosmin Truta
58eedced25 CMakeLists: Update the contributor list 2018-08-18 19:49:56 -04:00
Cosmin Truta
1d89a5db66 CMakeLists: Fix style 2018-08-18 19:49:56 -04:00
Cosmin Truta
43446b735d Fix a build warning on OpenBSD
(Contributed by Theo Buehler)
2018-08-12 23:46:02 -04:00
Cosmin Truta
6c059f8f5b configure: Remove the memset check and the HAVE_MEMSET macro
The compatibility workaround png_memset() has been removed long ago.
The availability of memset() is a platform requirement.
2018-08-11 00:47:18 -04:00
Cosmin Truta
f5d48df418 CMakeLists: Remove the PNGARG option
Pre-ANSI function prototypes are no longer supported.
2018-08-11 00:47:18 -04:00