Commit Graph

217 Commits

Author SHA1 Message Date
John Bowler
319c9852bf Unsigned overflow
Remove all currently detected cases of unsigned overflow.  Detection is
runtime, so test case dependent.  The changes to pngvalid.c eliminate
spurious and probably invalid tests with one while loop exception.

Apart from that and the change to the dependence on the intended
unsigned overflow in pngtrans.c the changes are limited to altering the
meme for an unsigned 'x' from:

   while (x-- > 0)

to

   for (; x > 0; --x)

This works because, in all cases, the control variable is not used in
the loop.  The 'while' meme was, at one time, warn'ed by GCC so it is
probably a good change, for some weird religious value of good.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-09-30 18:37:22 -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
9b14f5f85a [libpng16] Fix a bad indent in pngvalid.c 2016-07-13 17:21:31 -05:00
Glenn Randers-Pehrson
66f796e74c [libpng16] Imported from libpng-1.6.24beta03.tar 2016-07-04 09:55:12 -05:00
Glenn Randers-Pehrson
11c88033d4 [libpng16] Added "Common linking failures" section to INSTALL 2016-07-02 14:29:29 -05:00
John Bowler
54feb0ad2a pngimage: correct #define checking
In libpng 1.7 pngimage needs to check PNG_WRITE_PNG_SUPPORTED (new in 1.7), not
PNG_WRITE_SUPPORTED because png_write_png can be disabled without disabling
PNG_WRITE_SUPPORTED.  Copied the approach from 1.6 pngcp.c (so this still works
in 1.6 as well.)
2016-07-02 08:03:09 -07:00
Glenn Randers-Pehrson
b733c50bc0 [libpng16] Updated CHANGES and ANNOUNCE 2016-07-01 18:42:07 -05: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
3f2879bf60 [libpng16] Imported from libpng-1.6.24beta02.tar 2016-06-23 11:26:59 -05:00
Glenn Randers-Pehrson
4b4a9583b4 [libpng16] Imported from libpng-1.6.24beta02.tar 2016-06-23 11:08:06 -05:00
John Bowler
21d9e6e0fb SKIP definition in pngstest.c misplaced
The SKIP definition needs to come after the png.h include (see all the other .c
files in contrib/libtests) because it depends on PNG_LIBPNG_VER.  This commit
puts it in the correct place.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-06-22 17:38:56 -07:00
John Bowler
98af505439 Fix MSVC Level 4 warning
MSVC does not like (uInt) = -(unsigned) (i.e. as an initializer), but it is fine
with it if the conversion is explicitly invoked by a cast.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-06-22 17:37:20 -07:00
Glenn Randers-Pehrson
ed6db9d86b [libpng16] Imported from libpng-1.6.23.tar 2016-06-09 06:49:42 -05:00
John Bowler
bd2370c054 pngvalid.c: don't use size_t count arguments
Coverity rejects code where an array element count has type size_t, this
elminates the code in question from contrib/libtests/pngvalid.c

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-30 08:12:51 -07:00
Glenn Randers-Pehrson
dbfd68ae3a [libpng16] Update CHANGES, ANNOUNCE, and change date in pngvalid.c 2016-05-29 15:47:57 -05:00
John Bowler
801b925edf pngvalid.c: correct progressive read input buffer
The previous version of the code invariably passed just one byte at a time to
libpng.  The intention was to pass a random number of bytes in the range 0..511
(and this is what happens now).

Signed-off-by: John Bowler <jbowler@acm.org>
2016-05-29 09:30:00 -07:00
Glenn Randers-Pehrson
84cc738166 [libpng16] Imported from libpng-1.6.23beta01.tar 2016-05-29 09:47:30 -05:00
Glenn Randers-Pehrson
ac43a87820 [libpng16] Imported from libpng-1.6.22.tar 2016-05-26 07:25:14 -05:00
Glenn Randers-Pehrson
37ab4d946c [libpng16] Imported from libpng-1.6.22rc03.tar 2016-05-18 07:26:06 -05:00
Glenn Randers-Pehrson
21939d36ec [libpng16] Use PNG_UINT_31_MAX instead of constant 0x7fffffff in timepng.c 2016-04-29 21:48:52 -05:00
Glenn Randers-Pehrson
8c754b1834 [libpng16] Quieted two Coverity issues in contrib/libtests/timepng.c. 2016-04-28 21:23:37 -05:00
John Bowler
af9d06e06a timepng: better errors, fix signed overflow
Too many input files would overflow nfiles

Signed-off-by: John Bowler <jbowler@acm.org>
2016-04-13 10:04:08 -07:00
John Bowler
703944c39d timepng: C++ fixes, correct add_one_file
timepng would could a file as added even if it failed and the assembly file got
rewound.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-04-13 09:37:25 -07:00
John Bowler
e81f16bf5d timepng: more support requirements
Signed-off-by: John Bowler <jbowler@acm.org>
2016-04-12 21:17:22 -07:00
John Bowler
7572840cd0 timepng requires STDIO
Signed-off-by: John Bowler <jbowler@acm.org>
2016-04-12 21:10:04 -07:00
John Bowler
569a1d27b4 Fix timepng 'skip' return code.
Signed-off-by: John Bowler <jbowler@acm.org>
2016-04-12 21:04:27 -07:00
John Bowler
d642eede9a timepng: fix builds when there is no read support
Signed-off-by: John Bowler <jbowler@acm.org>
2016-04-12 21:01:50 -07:00
John Bowler
5b0a0ded05 ANSI C overlength string fix
Signed-off-by: John Bowler <jbowler@acm.org>
2016-04-12 20:43:29 -07:00
Krishnaraj Bhat
46c47291e8 gcc6: fix misleading indentation warning
Although not a bug in this case, but shows up when -Wall is used
2016-03-07 13:56:15 +05:30
John Bowler
2a25fc41f6 [libpng16] timepng usage message, ability to cache the test set
This makes tests slightly quicker by allowing the temporary file to be created
beforehand.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-02-28 12:24:52 -06:00
Glenn Randers-Pehrson
0df91242a2 [libpng16] Update CHANGES and ANNOUNCE, about timepng.c 2016-02-26 19:35:59 -06:00
John Bowler
9821954ecc contrib/libtests/timepng: make robust, improve
The code no longer gives up/fails on invalid PNG data, it just skips it (with
error messages).  The code no longer fails on PNG files with data beyond IEND.
Options exist to use png_read_png (reading the whole image, not by row) and, in
that case, to apply any of the supported transforms.  This makes for more
realistic testing; the decoded data actually gets used in a meaningful fashion.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-02-26 16:33:38 -08:00
Glenn Randers-Pehrson
a4a54aa1bf [libpng16] Imported from libpng-1.6.22beta02.tar 2016-02-08 17:13:06 -06:00
John Bowler
e717842a54 pngstest: options to fix per-file seed
Also avoid command output substition in tests/pngstest and fix the collation
locale to ASCII/C/POSIX

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-28 23:10:04 -08:00
John Bowler
98c6fa2495 PNG_IMAGE_PNG_SIZE_MAX error correction
The macro underreported the size (by up to 512 bytes) of an 8-bit non-color
palette based memory format because it failed to take into account that the
memory palette has to be expanded to full RGB when it is written to PNG.

This is not likely to be a serious bug because the macro is new, the memory
format in question is likely to be rarely used and the result of an undersized
buffer fails in a safe way.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-27 16:22:51 -08:00
John Bowler
ac796d3f9a Only use exit(77) in configure builds
Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-26 17:55:39 -08:00
Glenn Randers-Pehrson
f6a23fe205 [libpng16] Imported from libpng-1.6.22beta01.tar 2016-01-23 14:06:39 -06:00
Glenn Randers-Pehrson
93a3bc7343 [libpng16] Revised workaround for Coverity issue in pngvalid.c 2016-01-23 10:09:18 -06:00
John Bowler
7f576964d8 pngunknown.c: handle unknown IDAT
This is the test backported from 1.7 to ensure that when treating IDATs as
unknown the test does not fail if there are more than one IDAT chunks in the
file.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-18 19:19:14 -08:00
Glenn Randers-Pehrson
94f4e972b5 Merge branch 'libpng16-simple-memory-II' of git://github.com/jbowler/libpng-1 into libpng16 2016-01-18 12:43:36 -06:00
John Bowler
175a126a1a Simplified API: write-to-memory, overflow handling
This implements an API and provides a number of assist macros to allow an
application which uses the simplified API write to bypass stdio and write
directly to memory.

It also includes some warnings (png.h) and some check code to detect *possible*
overflow in the ROW_STRIDE and simplified image SIZE macros.  This disallows
image width/height/format that *might* overflow.  A quiet API change that limits
in-memory image size (uncompressed) to less that 4GByte and image row size
(stride) to less than 2GByte.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-18 09:53:38 -08: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
b8dbd78de8 [libpng16] Updated CHANGES, ANNOUNCE, and copyright notice in pngunknown.c 2016-01-18 09:09:33 -06:00
John Bowler
777dbf46dc pngunknown: fix NO_STDIO build
pngunknown.c calls png_init_io (always), skip the test if there is no stdio.h
support.

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-18 05:08:27 -08:00
Glenn Randers-Pehrson
e8558d2160 [libpng16] Changed PNG_USE_MKSTEMP to __COVERITY__ to select alternate
"tmpfile()" implementation in contrib/libtests/pngstest.c
2016-01-17 16:08:39 -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
780079e771 [libpng16] Worked around a false-positive Coverity issue in pngvalid.c. 2016-01-13 09:50:41 -06:00
John Bowler
b416dc5fc8 Mark 'limit' UNUSED in transform_range_check
Only affects release builds

Signed-off-by: John Bowler <jbowler@acm.org>
2016-01-06 12:58:01 -08:00
Glenn Randers-Pehrson
ecc022ee5f [libpng16] Bump version to libpng-1.6.21rc02.tar 2016-01-06 13:26:32 -06:00