Commit Graph

102 Commits

Author SHA1 Message Date
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
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
luz.paz
eb91c0e4ed More misc. typos
found via `codespell-q 3`
please review
2018-02-09 06:57:29 -05: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
9fcb846402 [libpng16] Imported from libpng-1.6.31.tar 2017-07-27 05:27:17 -05:00
John Bowler
72d07d3202 [libpng16] Removed one of the GCC-7.1.0 'strict-overflow' warnings that
result when integers appear on both sides of a compare.  Worked around the
  others by forcing the strict-overflow setting in the relevant functions to
  a level where they are not reported.
Changed "FALL THROUGH" comments to "FALLTHROUGH" because GCC doesn't like
  the space.
Worked around some C-style casts from (void*) because g++ 5.4.0 objects
  to them.
Increased the buffer size for 'sprint' to pass the gcc 7.1.0 'sprint
  overflow' check that is on by default with -Wall -Wextra.
2017-07-11 08:47:05 -05:00
Glenn Randers-Pehrson
b99308a33c [libpng16] Check for integer overflow in contrib/tools/genpng. 2017-04-23 18:41:28 -05:00
Viktor Szakats
b3ffdc5991 URL updates 2017-03-31 23:25:57 +00:00
Glenn Randers-Pehrson
0c440812db [libpng16] Imported from libpng-1.6.26.tar 2016-10-19 19:11:38 -05:00
Glenn Randers-Pehrson
436ce2c6e9 [libpng16] Bump version to 1.6.26rc02 2016-10-17 12:46:41 -05:00
Glenn Randers-Pehrson
90ea4af4a1 [libpng16] Update CHANGES and ANNOUNCE 2016-09-01 17:28:08 -05:00
John Bowler
f0b453bc3e [libpng16] pngfix zero-length IDAT fix
When an input file contains a zero length IDAT and pngfix is not applying the
IDAT rechunking (--max) option pngfix will go into a loop writing the zero
length IDAT for ever.

This is a fairly minor issue for interactive use; zero length IDAT is very rare,
the problem is obvious (pngfix hangs) and the fix (use --max, or --max=4096
etc), while not obvious, is easy.

For non-interactive use, e.g. trying to automatically repair a PNG that cannot
be read by libpng, there are security consequences:

1) pngfix hangs.  This may permit a DoS attack.
2) When the --out option is used pngfix will just keep writing.  This is a very
likely DoS scenario.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-09-01 07:22:40 -07:00
Glenn Randers-Pehrson
b50d5cea2b [libpng16] Imported from libpng-1.6.24.tar 2016-08-03 21:32:26 -05:00
Glenn Randers-Pehrson
ee079481c9 [libpng16] Imported from libpng-1.6.24beta06.tar 2016-07-19 17:00:00 -05:00
Glenn Randers-Pehrson
34c783e2fe [libpng16] Fix permission on reindent; add license info to contrib/tools/chkfmt 2016-07-14 18:53:30 -05:00
Glenn Randers-Pehrson
82d0009885 [libpng16] Add PD license to new "reindent" tool; remove unused environment var
I didn't intend to distribute this but it leaked into the libpng16 source,
so here it is.
2016-07-14 17:40:37 -05:00
Glenn Randers-Pehrson
3c7c436303 [libpng16] Imported from libpng-1.6.24beta05.tar 2016-07-14 09:55:35 -05:00
John Bowler
cfc19ff1b6 pngcp bug fixes
The fixed size buffer for the file name being processed could have a byte
written beyond the end; a bug where the test was updated without changing the
size of the buffer.  This commit reduces the buffer to the system maximum.

png_getrowbytes could, in theory, return 0; probably only if there is a bug in
libpng but the code now checks.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-07-03 13:49:36 -07:00
Glenn Randers-Pehrson
b733c50bc0 [libpng16] Updated CHANGES and ANNOUNCE 2016-07-01 18:42:07 -05:00
John Bowler
a93744423d pngcp.c: correct total time output
Signed-off-by: John Bowler <jbowler@acm.org>
2016-07-01 11:29:58 -07:00
John Bowler
9957c45073 pngcp: add high resolution timing
If PNG_PNGCP_TIMING_SUPPORTED is defined maximal resolution CPU time logging of
png_read_png and png_write_png is enabled via the --time command line option.
This is not on by default but is enabled by contrib/conftests/pngcp.dfa

Signed-off-by: John Bowler <jbowler@acm.org>
2016-07-01 11:29:45 -07:00
John Bowler
0ac91cc657 pngcp: tool to copy PNG files
This adds pngcp to the build together with a pngcp.dfa configuration test; the
test revealed some configuration bugs which are fixed by corrections to the
_SUPPORTED macros.

pngcp builds on all tested configurations and a number of bugs have been fixed
to make this happen relative to the version in libpng 1.7 contrib/examples.
pngcp.dfa will have to be different for 1.7 but pngcp.c should work fine (not
yet tested).  pngcp itself is still missing a usage message; this is a
preliminary version, although since it behaves the same way as 'cp' most unoids
shouldn't have a problem using it correctly.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-07-01 11:27:43 -07:00
Glenn Randers-Pehrson
95d2726ecc [libpng16] Update change dates in pngvalid.c and pngfix.c 2016-01-18 09:24:23 -06:00
Glenn Randers-Pehrson
5031c77d85 [libpng16] Bump version to 1.6.22beta01 2016-01-16 08:00:09 -06:00
Glenn Randers-Pehrson
fc0786a442 [libpng16] Imported from libpng-1.6.21.tar 2016-01-15 13:51:06 -06:00
Glenn Randers-Pehrson
ecc022ee5f [libpng16] Bump version to libpng-1.6.21rc02.tar 2016-01-06 13:26:32 -06:00
Glenn Randers-Pehrson
0de0101fdd [libpng16] Bump version to 1.6.21beta01 2015-12-08 22:19:15 -06:00
Glenn Randers-Pehrson
5b6a6f914b [libpng16] Imported from libpng-1.6.20.tar 2015-12-02 22:30:37 -06:00
Glenn Randers-Pehrson
e7092bc59c [libpng16] Imported from libpng-1.6.20rc01.tar 2015-11-26 07:04:24 -06:00
Glenn Randers-Pehrson
87049cbf84 [libpng16] Update CHANGES, ANNOUNCE, minor editing of contrib/*/*.c 2015-11-25 15:55:01 -06:00
John Bowler
f5778c8fbb Fix error in handling of bad zlib CMINFO field
Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-25 12:59:42 -08:00
John Bowler
c3e7e7d715 [libpng16] tests backported from libpng 1.7
This updates libpng16 with all the test changes from libpng17,
including changes to pngvalid.c to ensure that the original,
distributed, version of contrib/visupng/cexcept.h can be used.

pngvalid contains the correction to the use of SAVE/STORE_
UNKNOWN_CHUNKS; a bug revealed by changes in libpng 1.7.  More
tests contain the --strict option to detect warnings and the
pngvalid-standard test has been corrected so that it does not
turn on progresive-read (there is a separate test which does
that.)

Some signed/unsigned fixes have been made.

Signed-off-by: John Bowler <jbowler@acm.org>
2015-09-15 15:38:52 -07:00
Glenn Randers-Pehrson
8b83ff3704 [libpng16] Change "n bit" to "n-bit" in comments. 2015-08-13 20:57:18 -05:00
Glenn Randers-Pehrson
e6172809bd [libpng16] Imported from libpng-1.6.18.tar 2015-07-22 22:40:52 -05:00
Glenn Randers-Pehrson
a390897ba4 [libpng16] Fixed a new signed-unsigned comparison in pngrtran.c (Max Stepin).
Removed some useless typecasts from contrib/tools/png-fix-itxt.c
2015-07-01 14:06:39 -05:00
Glenn Randers-Pehrson
9d4ea3014b [libpng16] Imported from libpng-1.6.18beta08.tar 2015-06-30 10:54:44 -05:00
Glenn Randers-Pehrson
f6e7551f06 [libpng16] Eliminated the final two Coverity defects (insecure temporary file
handling in contrib/libtests/pngstest.c; possible overflow of
unsigned char in contrib/tools/png-fix-itxt.c). To use the "secure"
file handling, define PNG_USE_MKSTEMP, otherwise "tmpfile()" will
continue to be used.
2015-06-10 07:05:18 -05:00
Glenn Randers-Pehrson
867f2ec058 [libpng16] Imported from libpng-1.6.18beta07.tar 2015-06-06 17:03:14 -05:00
Glenn Randers-Pehrson
b26b51d154 [libpng16] Quieted Coverity issues in pngfix.c, png-fix-itxt.c, pngvalid.c,
pngstest.c, and pngimage.c. Most seem harmless, but png-fix-itxt
would only work with iTXt chunks with length 255 or less.
2015-06-03 16:07:01 -05:00
Glenn Randers-Pehrson
b66de48b3b [libpng16] Changed png_voidcast(), etc., to voidcast(), etc., in
contrib/tools/pngfix.c to avoid confusion with the libpng private macros.
2015-05-30 22:57:33 -05:00
John Bowler
0f12df19a1 [libpng16] Added PNG generation tool, fixed unitialized pointer in
simpleover. Also added a comment to png.h pointing out that the pointer must
 be set to NULL!  (simpleover crashes with any slightly complex command lines
 without this fix.)
2015-05-04 19:58:41 -05:00
Glenn Randers-Pehrson
218a6fe9e5 [libpng16] Bump version to 1.6.18beta01 2015-03-26 08:55:25 -05:00
Glenn Randers-Pehrson
c98f7fb4e3 [libpng16] Imported from libpng-1.6.17.tar 2015-03-26 08:11:12 -05:00
Glenn Randers-Pehrson
bc27b2f432 [libpng16] Imported from libpng-1.6.17rc02.tar 2015-03-09 09:20:46 -05:00
Glenn Randers-Pehrson
494e75ac83 [libpng16] Fixed some typos in the pngfix usage message. 2015-02-26 10:39:13 -06:00
Glenn Randers-Pehrson
018b4fccb9 [libpng16] Happy New Year! Update copyright year. 2014-12-31 18:45:23 -06:00
John Bowler
6a6eb354ff [libpng16] Removed user limits from pngfix. Also pass NULL pointers to
png_read_row to skip the unnecessary row de-interlace stuff.
2014-12-24 18:54:08 -06:00
Glenn Randers-Pehrson
f43b5e3709 [libpng16] Imported from libpng-1.6.16beta03.tar 2014-12-20 19:21:32 -06:00