Commit Graph

4082 Commits

Author SHA1 Message Date
Peter Kasting
d675c669c8 Fix an instance of -Wunused-but-set-variable.
See https://github.com/glennrp/libpng/pull/388
2022-03-20 15:58:34 +01:00
Vadim Zeitlin
dc6985f9d2 Avoid bogus -Wmaybe-uninitialized from gcc 11
It doesn't really matter that number_buf is not initialized because its
first characters are not going to be used anyhow (png_format_number()
returns a pointer to the actually used part of the string at the end),
but gcc-11 warns about it, so do initialize it just to make it happy.
2022-03-09 20:09:17 +01:00
Vadim Zeitlin
9853c67ab4 Merge branch 'apple-cond-use-inflate-validate' of https://github.com/discnl/libpng into wx
Fix check for availability of zlib's inflateValidate() under Apple
systems.

See https://github.com/wxWidgets/libpng/pull/5
2020-12-30 17:44:40 +01:00
Dimitri Schoolwerth
b825c1723d
Try to use inflateValidate in case of static zlib
When static linking zlib on iOS/macOS the usage of inflateValidate is
still unnecessarily based on OS version checks. Detect at least the case
where zlib functions are definitions (as a result of compiling zlib with
a prefix), allowing for unrestricted inflateValidate usage.
2020-12-17 17:01:20 +01:00
Dimitri Schoolwerth
e69f6b3e26
Add iOS/macOS run-time check for inflateValidate 2020-12-17 02:22:25 +01:00
Dimitri Schoolwerth
fd4a538c67
Add iOS compile-time check for inflateValidate
Don't use inflateValidate if targeting pre-iOS 11.
2020-12-17 02:16:30 +01:00
Dimitri Schoolwerth
759dc457a8
Fix continued undesired usage of inflateValidate
Macro MAC_OS_X_VERSION_MIN_REQUIRED isn't present through, coincidental,
inclusion of <Availability.h>, which means inflateValidate can still be
used resulting in a warning when targeting pre-10.13 and a crash if
called pre-10.13 as described in (attempted fix) bda2970c65.

Fix by including the needed header explicitly.
2020-12-17 01:49:19 +01:00
Dimitri Schoolwerth
dfc331f0bd
Refactor check for zlib's inflateValidate presence
No compile-time changes. Refactor a single and expanding statement
checking for availability of inflateValidate into an option.
2020-12-16 17:09:22 +01:00
maccy2
3ffeff7877 Fix: 'inflateValidate' is only available on macOS 10.13 or newer
The warning occurs when compiling the latest wxWidgets 3.1.1 on macOS
and will cause the final application code to crash if run on macOS <
10.13. The patch fixes the issue, following this one:
8d2a287da3/external/libpng/libpng-osx.patch.1

See https://github.com/wxWidgets/libpng/pull/1
2020-07-21 22:29:54 +02:00
Vadim Zeitlin
46b17e804b Avoid -Wundef for MIPS and PPC symbols too
This is similar to d532334ef (Avoid -Wundef warnings when building
libpng, 2017-11-13), but for the similar symbols used under the other
architectures: always define them, even if just as 0, to avoid gcc
warnings when comparing them with 0 later.
2020-05-02 20:29:26 +02:00
Maarten Bent
f1ecc2c50d Don't enable SSE2 optimizations when using VC9 and older compiler 2020-04-23 22:38:12 +02:00
Vadim Zeitlin
8cb5f8f158 Avoid -Wundef warnings for PNG_ARM_NEON_IMPLEMENTATION
Define this symbol as 0 instead of leaving it undefined when not using
ARM NEON optimizations.

No real changes, but just avoid a bunch of

"PNG_ARM_NEON_IMPLEMENTATION" is not defined, evaluates to 0 [-Wundef]

warnings when building the library.
2020-02-04 22:48:25 +01:00
Maarten Bent
5668fc8fd6 Regenerate pnglibconf.h and pngprefix.h files
Perform the steps as explained in the main repository in
docs/contributing/how-to-update-third-party-library.md.
2020-01-16 21:23:29 +01:00
Maarten Bent
d8030c38a2 Merge tag 'v1.6.37' into wx 2020-01-16 21:16:59 +01: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
Maarten Bent
772e393c7e Regenerate pnglibconf.h and pngprefix.h files
Perform the steps as explained in the main repository in
docs/contributing/how-to-update-third-party-library.md.
2018-11-17 13:10:44 +01:00
Maarten Bent
6292b3d6bc Merge tag 'v1.6.35' into wx 2018-11-17 13:00:32 +01: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