Commit Graph

4057 Commits

Author SHA1 Message Date
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
Cosmin Truta
9730362202 CMakeLists: Avoid symlinks on MSYS
create_symlink breaks the MSYS generator in the Windows CMake.
2018-08-10 00:58:48 -04:00
Cameron Cawley
7cb7afb43d CMake: Fix compilation on systems without libm 2018-08-01 00:24:48 -04:00
Cosmin Truta
1bd4214a42 Clean up the scripts/ directory
Delete the files that are unused, redundant, or fundamentally broken:
def.c, makefile.bor, makefile.knr, makefile.msc, makefile.solaris-x86,
makefile.tc3
2018-07-29 22:19:43 -04:00
Cosmin Truta
6d55a14c58 Update projects/vstudio 2018-07-29 21:51:48 -04:00
Cosmin Truta
8440326590 Update the documentation 2018-07-29 00:33:12 -04:00
Cosmin Truta
b729fff4a3 Remove the Y2K compliance statement
As of July 2018, this statement is no longer necessary.
2018-07-28 23:39:55 -04:00
Cosmin Truta
c36c09f004 Update the export control information
Also reformat the license text.
2018-07-28 23:00:48 -04:00
Cosmin Truta
a873893279 Remove the "last changed" version information from source comments
This information is maintained by the version control system.
2018-07-28 18:47:21 -04:00
Cosmin Truta
47f18784e4 Rerun autogen.sh 2018-07-28 18:34:58 -04:00
Cosmin Truta
d4fb621429 Bump version to 1.6.36.git and update copyright notice 2018-07-28 18:34:58 -04:00
Vicki Pfau
fb6312a9f9 ARM: Disable hand-written AArch32 NEON on AArch64 2018-07-16 22:52:24 -04:00
Vicki Pfau
ddc842bf06 CMakeLists: Fix passing "off" for PNG optimizations 2018-07-16 22:52:04 -04:00
Vicki Pfau
46924bd877 CMakeLists: Fix disabling hardware optimizations 2018-07-16 22:50:32 -04:00
Cosmin Truta
8da397423e [master] Imported from libpng-1.6.35.tar 2018-07-15 23:58:00 -04:00