Commit Graph

608 Commits

Author SHA1 Message Date
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
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
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
43446b735d Fix a build warning on OpenBSD
(Contributed by Theo Buehler)
2018-08-12 23:46:02 -04:00
Cosmin Truta
46aedd8961 Release libpng version 1.6.35 2018-07-15 23:58:00 -04:00
Cosmin Truta
a74aa9a002 [libpng16] Replace the remaining uses of png_size_t with size_t
In v1.6.0, size_t became a required type. It should be used
consistently. To maintain backwards compatibility, png_size_t
is still maintained in deprecated form.
2018-06-17 22:37:44 -04:00
Glenn Randers-Pehrson
0e06b5948c [libpng16] Imported from libpng-1.6.35beta01.tar 2018-03-06 14:06:24 -06:00
luz.paz
eb91c0e4ed More misc. typos
found via `codespell-q 3`
please review
2018-02-09 06:57:29 -05:00
Glenn Randers-Pehrson
28d0ee757d [libpng16] temporarily disable 16-to-8 downscaling in the fuzzer 2017-12-17 17:52:45 -06:00
Unknown
f23b41d7b1 Misc. typos
Some are user facing. Some are in actual code. Most are in source comments. Also, please double check the changes in contrib/tools/pngfix.c
2017-11-03 00:52:06 -04:00
Glenn Randers-Pehrson
5d7b4ab289 [libpng16] Replace png_set_add_alpha with png_set_trns_to_alpha in fuzzer. 2017-10-30 15:16:33 -05:00
Glenn Randers-Pehrson
ccc77d2a8d [libpng16] Add a call to png_set_packing() to the fuzzer. 2017-10-14 11:33:59 -05:00
Glenn Randers-Pehrson
f648294931 [libpng16] Removed call to png_read_start_image() from the fuzzer. In libpng16
it is an error to call that along with png_read_update_info().
2017-10-13 14:00:36 -05:00
Glenn Randers-Pehrson
83f27f018c [libpng16] Relocate png_read_update_info() wrt png_start_image() in fuzzer. 2017-10-12 20:10:40 -05:00
Glenn Randers-Pehrson
fefe0affc1 [libpng16] Update CHANGES and ANNOUNCE and last-changed date in the fuzzer. 2017-10-12 14:30:36 -05:00
Glenn Randers-Pehrson
a3d1057a73 [libpng16] Fix typo in fuzzer (png_info_ptr should be info_ptr) 2017-10-11 16:58:39 -05:00
Glenn Randers-Pehrson
12384eae6f [libpng16] Relocate malloc of row_ptr after png_read_update_info() in fuzzer 2017-10-11 16:28:14 -05:00
Glenn Randers-Pehrson
357af1f095 ]libpng16] Add png_read_update_info() where needed in the fuzzer 2017-10-11 11:56:30 -05:00
Glenn Randers-Pehrson
ab791fc9d6 [libpng16] Add some commonly-used transforms to the libpng fuzzer 2017-10-10 20:30:54 -05:00
Glenn Randers-Pehrson
f5f8b98dbb [libpng16] Remove "cd ../libpng" from oss-fuzz build.sh 2017-10-09 21:02:15 -05:00
Glenn Randers-Pehrson
293b6aaa59 [libpng16] Revert to using the system zlib with the libpng fuzzer 2017-10-07 12:38:04 -05:00
Glenn Randers-Pehrson
98a3b2a5c2 [libpng16] Use --with-libpng-prefix=OSS_FUZZ_ while building the fuzzer 2017-10-07 09:46:51 -05:00
Glenn Randers-Pehrson
78ad1208d6 [libpng16] Use "--with-zlib-prefix=z_" while building oss-fuzz fuzzer 2017-10-05 08:31:26 -05:00
Glenn Randers-Pehrson
477a241c10 [libpng16] Use --zprefix in oss-fuzz libpng build to avoid conflict with system libz. 2017-10-03 09:51:09 -05:00
Glenn Randers-Pehrson
edb1f47139 [libpng16] Clone zlib into the oss-fuzz zlib project and build zlib alongside libpng. 2017-10-01 16:21:16 -05:00
Glenn Randers-Pehrson
0f9f170e9f [libpng16] Restore bad interlaced files, in contrib/pngsuite/interlaced 2017-09-29 18:15:53 -05:00
Glenn Randers-Pehrson
99d4a62c9a [libpng16] Restored 21 of the contrib/pngsuite/i*.png, which were correct. 2017-09-29 11:06:17 -05:00
Glenn Randers-Pehrson
b78804f9a2 [libpng16] Imported from libpng-1.6.34.tar 2017-09-29 03:42:33 -05:00
Glenn Randers-Pehrson
2ee8cb0559 [libpng16] Imported from libpng-1.6.33.tar 2017-09-28 13:58:30 -05:00
Glenn Randers-Pehrson
414de98047 [libpng16] Add end_info structure to libpng fuzzer; add row_ptr to CLEANUP 2017-09-28 09:20:20 -05:00
Glenn Randers-Pehrson
0512c63533 [libpng16] Revert contrib/oss-fuzz/libpng_read_fuzzer.cc to libpng-1.6.32 status 2017-09-27 18:05:07 -05:00
Glenn Randers-Pehrson
cae11e3e43 [libpng16] Treat benign errors as warnings in the libpng fuzzer 2017-09-27 08:19:11 -05:00
Glenn Randers-Pehrson
4f0a0b9a94 [libpng16] Build fuzzer with "-O0" to defeat optimizer removing "dead" code 2017-09-25 08:15:51 -05:00
Glenn Randers-Pehrson
dc22583aca [libpng16] Undo another faulty attempt to defeat the compiler from
optimizing out the the core of libpng_read_fuzzer.cc
2017-09-25 03:54:22 -05:00
Glenn Randers-Pehrson
346cbf2c2a [libpng16] Another attempt to defeat the fuzzer optimizer 2017-09-24 09:25:12 -05:00
Glenn Randers-Pehrson
8eb79b3435 [libpng16] Undo faulty attempt to defeat the fuzzer optimizer 2017-09-24 08:31:08 -05:00
Glenn Randers-Pehrson
96333b6bea [libpng16] Defeat optimization that removes reading rows in the fuzzer. 2017-09-23 10:34:40 -05:00
Glenn Randers-Pehrson
8746d57184 [libpng16] Fix some color types and bit depths in new pngsuite files 2017-09-22 16:15:12 -05:00
Glenn Randers-Pehrson
60d297d592 [libpng16] Added interlaced versions of each file in contrib/pngsuite. 2017-09-21 20:09:50 -05:00
Glenn Randers-Pehrson
5f0c9fabbc [libpng16] Bump version to 1.6.33rc01 2017-09-20 15:50:17 -05:00
Glenn Randers-Pehrson
4de130c255 [libpng16] Imported from libpng-1.6.33beta03.tar 2017-09-14 12:46:28 -05:00
Glenn Randers-Pehrson
051dcaf877 [libpng16] Added a copy of Dockerfile to the contrib/oss-fuzz directory 2017-09-08 08:19:31 -05:00
Glenn Randers-Pehrson
4e9839d453 [libpng16] Update "last changed" date in contrib/oss-fuzz/*.cc 2017-09-05 18:51:36 -05:00