Commit Graph

4089 Commits

Author SHA1 Message Date
1817d20ed3 Remove unnecessary trash from LTS repo 2021-06-04 19:23:36 +01:00
Cristian Rodríguez
dbe3e0c43e libpng.pc.in: zlib dependency is private
zlib should be injected only when pkgconfig is ran with the --static
option.
2020-05-24 23:28:35 -04:00
Cosmin Truta
2f753e260c ci: Verify the install target
Add support for the install target in ci_autotools.sh and ci_cmake.sh.
Also add the environment option CI_NO_INSTALL.
2020-05-24 22:09:45 -04:00
Cosmin Truta
f5d5f5ae0e cmake: Refactor the install target; reformat
Use standard CMake variables in the install target.
Reformulate comments and error messages.
Move all CMake keywords in front of their arguments.
Fix indentation.
2020-05-24 22:01:40 -04:00
Cosmin Truta
3676fd324a ci: Add a new top-level directory, dedicated for CI verification
Update the ci_*.sh scripts and move them to the more conventional
ci/ directory. Update .appveyor.yml and .travis.yml, as well as
the AUTHORS file, accordingly.

Speed up ci_cmake.sh: add "-DPNG_TESTS=OFF" to the list of CMake
variables if CI_NO_TEST is true.

Remove "sudo: false" from .travis.yml.

Refactor .appveyor.yml.
2020-05-18 21:30:30 -04:00
Alex Gaynor
28c0f8895e cmake: Add an option to enable/disable building of executables
Add the CMake option PNG_EXECUTABLES (on by default) in order to
allow or disallow the building of non-essential executable programs
associated with libpng.

Contributed-by: Alex Gaynor <alex.gaynor@gmail.com>
Contributed-by: Cosmin Truta <ctruta@gmail.com>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
2020-05-18 18:46:32 -04:00
Cosmin Truta
87378bc21d mips: Remove "last changed" version information from source comment
This information is maintained by the version control system.
2020-05-17 20:26:28 -04:00
gxw
6c6f7d105a mips: Fix initialization: always close "/proc/cpuinfo" 2020-05-17 20:26:28 -04:00
Simon Hausmann
6842c58adc Fix CMake build with Emscripten
When building with Emscripten, linkage to libm is neither required
nor working. As find_library will fail, M_LIBRARY will be set to
NOTFOUND and the build would fail later. The build works just fine
without libm linkage.
2020-05-17 20:13:17 -04:00
Dan Field
a6fc80300f Add an __LLVM,__asm section for clang builds on ARM 2020-05-17 20:00:46 -04:00
Steve Robinson
5e8b45c436 cmake: Fix a build error on iOS
Avoid the awk-based configuration when cross-compiling from macOS
to iOS.
2020-05-17 19:50:18 -04:00
Zack Middleton
6dd99ca9c8 Fix example.c 2020-04-27 01:27:07 -04:00
willson-chen
52ee167644 Fix a warning on Linux caused by _BSD_SOURCE
I got a warning while compiling under Ubuntu 18.04 and gcc 7.4:
"__BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

Quote from the Linux Programmer's Manual:
"To allow code that requires _BSD_SOURCE in glibc 2.19 and earlier and
_DEFAULT_SOURCE in glibc 2.20 and later to compile without warnings,
define both _BSD_SOURCE and _DEFAULT_SOURCE."
2020-04-27 00:46:06 -04:00
skal
eb6767273a Fix memory leak if eXIf has incorrect crc
Problem description:
Imagine a bitstream with an eXIf data segment that has invalid CRC.
If png_crc_finish() fails at line 2090, info_ptr->eXIf_buf is not freed
(despite the free_me setting at line 2062) because png_free_data() is
not called. png_read_info() is actually looping several time over the
png_eXIf chunk, calling png_handle_eXIf() several time in a row without
freeing the buffer.

This patch fixes the problem by leaving info_ptr's content in a clean
state in case of failure, as it is done at line 2084.
2020-04-27 00:16:36 -04:00
David Callu
9f734b13f4 cmake: Use the correct ZLIB_* variable names
ZLIB_LIBRARIES and ZLIB_INCLUDE_DIRS are the official cmake variable
names.
2020-04-26 23:54:11 -04:00
Cosmin Truta
3cec1a16f5 scripts: Clean up the makefiles
Delete variables (ALIGN, ARCH, DOCS) and targets (writelock) that are
no longer necessary.

Reorder the object file lists alphabetically, consistently across all
makefiles and build scripts.

Apply other minor fixes.
2020-03-29 23:58:29 -04:00
Cosmin Truta
50bd1abdb1 scripts: Fix makefile.std and include it in the CI verification 2020-03-29 22:26:32 -04:00
Cosmin Truta
2dd5630eae Update configuration for Travis CI; add configuration for AppVeyor CI
Exclude the branch "libpng16" from testing. It's identical to "master".
Also exclude the other (non-current) "libpng[0-1][0-7]" branches.

Parallelize the builds and the unit tests.

For Travis CI, update the build matrix as follows:
 * On Linux, use both clang and gcc.
 * On macOS, use clang only, with and without Xcode.

For AppVeyor CI, add a build matrix as follows:
 * On Windows, use Microsoft Visual Studio 2019 on x86, x64 and arm64.
 * Also on Windows, use MSYS2 on x86 and x64.

Use the new scripts/ci_*.sh; remove the old scripts/travis.sh.
2020-03-29 01:11:42 -04:00
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