Commit Graph

707 Commits

Author SHA1 Message Date
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
John Bowler
28a1cdfc2e Fix inconsistent handling of invalid zlib data
In libpng 1.6 zlib initialization was changed to use the window size in the zlib
stream, not a fixed value.  This causes some invalid images, ones where CINFO is
too large, to display 'correctly' if the rest of the data is valid.  This
provides a work-round for zlib versions where the error arises (ones that
support the API change to use the window size in the stream).

Signed-off-by: John Bowler <jbowler@acm.org>
2015-11-27 23:57:39 -08:00
Glenn Randers-Pehrson
27f08ac11d [lbpng16] Revert 12 -> 12U change in pngrutil.c 2015-11-22 22:59:47 -06:00
Glenn Randers-Pehrson
8ba160ba94 [libpng16] Use unsigned constants in buffer length comparisons 2015-11-21 14:31:59 -06:00
John Bowler
1ceedd0bf6 [libpng16] Another whack at png_handle_sPLT() pointer calculation. 2015-11-19 20:45:08 -06:00
Glenn Randers-Pehrson
001513c9ca [libpng16] Removed new redundant check for libpng < 12 in pngrutil.c 2015-11-17 16:23:51 -06:00
Glenn Randers-Pehrson
162f9f87f9 [libpng16] Remove newly-added useless typecasts. 2015-11-16 09:23:25 -06:00
Glenn Randers-Pehrson
9965f63a44 [libpng16] Changed size_t to png_uint_32 in new buffer checks (John Bowler) 2015-11-15 15:27:22 -06:00
Glenn Randers-Pehrson
070a0eb58f [libpng16] Revised recent pngrutil.c patch as suggested by pascal 2015-11-14 16:45:26 -06:00
Glenn Randers-Pehrson
0b4e7deab1 [libpng16] Avoid potential pointer overflow in png_handle_sPLT() and
png_handle_pCAL() (Bug report by John Regehr).
2015-11-13 11:05:27 -06:00
Glenn Randers-Pehrson
415d26805a [libpng16] Imported from libpng-1.6.19.tar 2015-11-12 07:13:31 -06:00
Glenn Randers-Pehrson
83f4c735c8 [libpng16] Clean up coding style in png_handle_PLTE() 2015-11-05 11:18:44 -06:00
Glenn Randers-Pehrson
9f2ad4928e [libpng16] Fixed new bug with CRC error after reading an over-length palette. 2015-11-04 23:47:42 -06:00
Glenn Randers-Pehrson
1bef8e9799 [libpng16] Silently truncate over-length PLTE chunk while reading. 2015-10-30 11:34:37 -05:00
Glenn Randers-Pehrson
a901eb3ce6 [libpng16] Prevent reading over-length PLTE chunk (Cosmin Truta). 2015-10-30 07:57:49 -05:00
John Bowler
2d62f7406f [libpng16] Fixed the recently reported 1's complement security issue by
replacing the value that is illegal in the PNG spec, in both signed and
unsigned values, with 0. Illegal unsigned values (anything greater than or equal
to  0x80000000) can still pass through, but since these are not illegal
in ANSI-C (unlike 0x80000000 in the signed case) the checking that
occurs later can catch them (John Bowler).
2015-08-19 12:56:48 -05:00
Glenn Randers-Pehrson
a8242fe6fb [libng16] Reverted recent mistaken change of 0xnnnn to 0xnnnnUL 2015-08-17 20:46:27 -05:00
Glenn Randers-Pehrson
15e69748f1 [libpng16] Removed new unnecessary typecast in pngrutil.c 2015-08-17 12:52:56 -05:00
Glenn Randers-Pehrson
268c7bf68b [libpng16] Use unsigned hex constants in "reciprocal" computations 2015-08-17 12:40:19 -05:00
Glenn Randers-Pehrson
d8b93c29a7 [libpng16] Appended more "UL" to hex constants. 2015-08-17 10:56:17 -05:00
Glenn Randers-Pehrson
b9ba8d6a57 [libpng16] Mention in manual that 16-bit platform support has been dropped. 2015-08-16 23:32:04 -05: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
e485a09e0e [libpng16] Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler
(Bug report by Viktor Szaka'ts).  Several warnings remain and are
unavoidable, where we test for overflow.
2015-07-29 07:29:17 -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
f86720c6c0 [libpng16] Fix some indentation. 2015-06-11 22:00:14 -05:00
John Bowler
8ee821e69a [libpng16] PNG_RELEASE_BUILD replaces tests where the code depended on the build base
type and can be defined on the command line, allowing testing in beta builds. Back
ported from libpng17.
2015-05-06 20:03:14 -05:00
Glenn Randers-Pehrson
c861dc8923 [libpng16] Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler
(Bug report by Viktor Szaka'ts).
2015-04-01 12:06:01 -05:00
Glenn Randers-Pehrson
bd85b5713c [libpng16] Imported from libpng-1.6.18beta01.tar 2015-04-01 08:24:14 -05:00
Glenn Randers-Pehrson
d344589703 [libpng16] Removed PNG_SET_CHUNK_[CACHE|MALLOC]_LIMIT_SUPPORTED macros. They
have been combined with PNG_SET_USER_LIMITS_SUPPORTED (resolves
bug report by Andrew Church).
2015-03-27 08:58:32 -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
c5370ede95 [libpng16] Reverted "& 0xff" additions of version 1.6.17beta01. Libpng passes
the Coverity scan without them.
2015-03-21 11:54:32 -05:00
Glenn Randers-Pehrson
bb098218ca [libpng16] Fixed some spelling (occur* -> occurr*), Bug report by Lauri Nurmi 2015-03-07 12:59:48 -06:00
Glenn Randers-Pehrson
7011a8cec3 [libpng16] Added "& 0xff" to things being typecast to "png_byte". 2015-02-27 18:53:44 -06:00
Sergey Kosarevsky
9a3de48b48 [libpng16] Avoid runtime checks when converting integer to png_byte with
Visual Studio (Sergey Kosarevsky)
2015-02-27 18:47:43 -06:00
Glenn Randers-Pehrson
6ef579df50 [libpng16] Imported from libpng-1.6.17beta01.tar 2015-01-28 19:15:16 -06:00
Glenn Randers-Pehrson
bd76965879 [libpng16] Added #ifndef __COVERITY__ where needed in png.c, pngrutil.c and
pngset.c to avoid warnings about dead code.
2015-01-27 06:53:56 -06:00
Glenn Randers-Pehrson
018b4fccb9 [libpng16] Happy New Year! Update copyright year. 2014-12-31 18:45:23 -06:00
John Bowler
dc294204b6 [libpng16] Fixed an overflow in png_combine_row with very wide interlaced
images.
2014-12-21 17:11:33 -06:00
Glenn Randers-Pehrson
06ee38423b [libpng16] Imported from libpng-1.6.16rc02.tar 2014-12-21 13:54:45 -06:00
Glenn Randers-Pehrson
6d8c88177a [libpng16] Imported from libpng-1.6.16rc01.tar 2014-12-21 09:18:15 -06:00
Glenn Randers-Pehrson
f43b5e3709 [libpng16] Imported from libpng-1.6.16beta03.tar 2014-12-20 19:21:32 -06:00
Glenn Randers-Pehrson
e8ef689cb9 [libpng16] Imported from libpng-1.6.15.tar 2014-11-20 10:22:57 -06:00
Glenn Randers-Pehrson
cda68df8c1 [libpng16] Changed "#endif /* PNG_FEATURE_SUPPORTED */" to "#endif /* FEATURE */" 2014-11-06 22:11:39 -06:00
Glenn Randers-Pehrson
b963feeec6 [libpng16] More cosmetic changes 2014-11-01 13:18:36 -05:00
Glenn Randers-Pehrson
5d713fe123 [libpng16] Changed remaining "if (!x)" to "if (x == 0)" and "if (x)" to
"if (x !== 0)"
2014-10-31 20:58:40 -05:00
Glenn Randers-Pehrson
c6a8cb7d10 [libpng16] Added missing "ptr = NULL" after some instances of png_free(). 2014-10-29 08:27:34 -05:00
Glenn Randers-Pehrson
ebba0746bc [libpng16] Changed "if (!x)" to "if (x == 0)" and "if (x)" to "if (x !== 0)" 2014-10-25 12:22:39 -05:00
Glenn Randers-Pehrson
edb772fd6d [libpng16] Imported from libpng-1.6.14.tar 2014-10-22 19:32:52 -05:00
Glenn Randers-Pehrson
48e6fad71c [libpng16] Fixed incorrect handling of the iTXt compression flag
in pngrutil.c (bug report by Shunsaku Hirata).  Bug was introduced
in libpng-1.6.0.
2014-09-27 09:37:50 -05:00
Glenn Randers-Pehrson
664bd637b5 [libpng16] Fixed some indentation in pngrutil.c 2014-08-26 19:55:58 -05:00
Glenn Randers-Pehrson
3efbecab92 [libpng16] Imported from libpng-1.6.13beta02.tar 2014-07-21 17:21:21 -05:00
Glenn Randers-Pehrson
212fd5745d [libpng16] Bump version to 1.6.13beta01 2014-06-11 21:13:33 -05:00
Glenn Randers-Pehrson
e429c66cea [libpng16] Imported from libpng-1.6.12.tar 2014-06-11 20:41:51 -05:00
Glenn Randers-Pehrson
da7b692ce0 [libpng16] Bump version to 1.6.12beta01 2014-06-06 11:57:30 -05:00
Glenn Randers-Pehrson
c4e0f3de64 [libpng16] Imported from libpng-1.6.11.tar 2014-06-05 10:00:45 -05:00
Glenn Randers-Pehrson
72855fb11e [libpng16] Made progressive reading of interlaced images consistent with the
behavior of the sequential reader and consistent with the manual. The
row_callback now receives the proper pass number and unexpanded rows,
when png_combine_row is not used or not built, by moving some code
out of the PNG_READ_INTERLACING_SUPPORTED blocks.
2014-04-13 21:27:25 -05:00
Glenn Randers-Pehrson
fa26eb1678 [libpng16] Fixed a typo in pngrutil.c, introduced in libpng-1.5.6, that
interferes with "blocky" expansion of sub-8-bit interlaced PNG files.
2014-04-06 09:06:37 -05:00
Glenn Randers-Pehrson
05670156f3 [libpng16] Use "if (value != 0)" instead of "if (value)" consistently. 2014-03-08 12:39:52 -06:00
Glenn Randers-Pehrson
71d23c4d6e [libpng16] Bump version to 1.6.11beta01 2014-03-06 21:09:24 -06:00
Glenn Randers-Pehrson
4df37bfa4f [libpng16] Imported from libpng-1.6.10.tar 2014-03-06 12:49:17 -06:00
Glenn Randers-Pehrson
b8f433417f [libpng16] Removed unreachable return statement after png_chunk_error()
in pngrutil.c
2014-02-27 12:12:54 -06:00
Glenn Randers-Pehrson
45625eceb4 [libpng16] Don't recognize known sRGB profiles as sRGB if they have been hacked,
but don't reject them and don't issue a copyright violation warning.
Simplified code in pngrutil.c that decides whether to warn about an
incorrect ancillary PLTE chunk.
2014-02-22 23:09:27 -06:00
Glenn Randers-Pehrson
eb657ae68f [libpng16] Added png_ptr->process_mode = PNG_READ_IDAT_MODE in
png_push_read_chunk after recognizing the IDAT chunk, which avoids an
infinite loop while reading a datastream whose first IDAT chunk is of
zero-length.
2014-02-22 21:59:40 -06:00
Glenn Randers-Pehrson
9c5a1baea5 [libpng16] Check for info_ptr == NULL early in png_read_end() so we don't need
to run all the png_handle_*() and depend on them to return if info_ptr == NULL.
This improves the performance of png_read_end(png_ptr, NULL) and makes
it more robust against future programming errors.
2014-02-17 09:12:52 -06:00
Glenn Randers-Pehrson
9eec159ab0 [libpng16] Imported from libpng-1.6.10beta01.tar 2014-02-09 13:00:23 -06:00
John Bowler
414d7b5f7d [libpng16] Backport recent changes from libpng-1.7.0beta30 and beta31. 2014-02-06 11:39:25 -06:00
Glenn Randers-Pehrson
be3977de2c [libpng16] Imported from libpng-1.6.8.tar 2013-12-19 09:11:01 -06:00
Glenn Randers-Pehrson
3f8a2ed600 [libpng16] Removed or marked PNG_UNUSED some harmless "dead assignments"
reported by clang scan-build.
2013-11-25 10:38:21 -06:00
John Bowler
aaf1bb1ae1 [libpng16] Updated "last changed" dates 2013-11-22 15:40:52 -06:00
Glenn Randers-Pehrson
113213416c [libpng16] Conditionally compile some unused functions reported by -Wall
in pngminim.
2013-11-18 20:12:24 -06:00
Glenn Randers-Pehrson
0ea69cdfa9 [libpng16] Imported from libpng-1.6.7.tar 2013-11-14 12:28:05 -06:00
John Bowler
0441ff62e7 [libpng16] Remove spurious "#ifdef PNG_sRGB_SUPPORTED" from pngrutil.c 2013-10-04 19:28:48 -05:00
Glenn Randers-Pehrson
b3721757a0 [libpng16] Catch up with some recent changes that did not get merged. 2013-09-30 13:56:44 -05:00
John Bowler
8f381901e3 [libpng16] Avoid up-cast warnings in pngvalid.c. On ARM the alignment
requirements of png_modifier are greater than that of png_store and as a
consequence compilation of pngvalid.c results in a warning about increased
alignment requirements because of the bare cast to (png_modifier*). The code
is safe, because the pointer is known to point to a stack allocated
png_modifier, but this change avoids the warning.

  Fixed default behavior of ARM_NEON_API. If the ARM NEON API option was
    compiled without the CHECK option it defaulted to on, not off.

  Check user callback behavior in pngunknown.c. Previous versions compiled
    if SAVE_UNKNOWN was not available but did nothing since the callback
    was never implemented.

  Merged pngunknown.c with 1.7 version and back ported 1.7 improvements/fixes
2013-09-30 11:24:17 -05:00
John Bowler
15a80443de [libpng16] Allow HANDLE_AS_UNKNOWN to work when other options are configured
off. Also fixed the pngminim makefiles to work when $(MAKEFLAGS) contains stuff
which terminates the make options (as by default in recent versions of Gentoo).
2013-09-21 10:06:32 -05:00
Glenn Randers-Pehrson
6f8f004fe1 [libpng16] Added #ifdef PNG_READ_SUPPORTED/endif around the
png_chunk_unknown_handling() function, and restored the unknown-chunk
handling code from libpng-1.6.6.

Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe)
or to glennrp at users.sourceforge.net

Glenn R-P
2013-09-20 15:40:15 -05:00
Glenn Randers-Pehrson
873f16fe2f [libpng16] Reverted the change to unknown handling #defines; the change
breaks 'NOREAD' builds.
2013-09-20 14:28:50 -05:00
Glenn Randers-Pehrson
7ae451f527 [libpng16] Bump version to 1.6.7beta01 2013-09-16 11:47:17 -05:00
Glenn Randers-Pehrson
391459424e [libpng16] Imported from libpng-1.6.6.tar 2013-09-16 10:39:16 -05:00
Glenn Randers-Pehrson
53ae7dc514 [libpng16] Imported from libpng-1.6.5.tar 2013-09-14 09:44:09 -05:00
Glenn Randers-Pehrson
cd6a3ef31f [libpng16] Bump version to 1.6.5beta01 2013-09-12 08:02:22 -05:00
Glenn Randers-Pehrson
209d3eb5c6 [libpng16] Imported from libpng-1.6.4.tar 2013-09-12 07:27:14 -05:00
Glenn Randers-Pehrson
8c49ddcf56 [libpng16] Imported from libpng-1.6.4beta02.tar 2013-08-29 19:39:34 -05:00
Glenn Randers-Pehrson
324402044f [libpng16] Imported from libpng-1.6.4beta01.tar 2013-08-21 18:45:24 -05:00
Glenn Randers-Pehrson
685d79e27a [libpng16] Delay calling png_init_filter_functions() until a row with nonzero
filter is found.
2013-08-20 21:15:31 -05:00
Glenn Randers-Pehrson
847e9efb66 [libpng16] Imported from libpng-1.6.3.tar 2013-07-17 19:13:23 -05:00
Glenn Randers-Pehrson
db56fa18c2 [libpng16] Revised "/*SAFE*/" comment in pngrutil.c 2013-07-15 10:09:54 -05:00
Glenn Randers-Pehrson
bc8e40d611 [libpng16] Added "/* SAFE */" comments in pngrutil.c and pngrtran.c
where warnings may be erroneously issued by code-checking applications.
Revised manual about changes in iTXt chunk handling made in libpng-1.6.0.
2013-07-15 08:44:53 -05:00
Glenn Randers-Pehrson
56a1a66656 [libpng16] Imported from libpng-1.6.3beta09.tar 2013-06-27 18:01:30 -05:00
John Bowler
9afb90f885 [libpng16] Attempt to detect configuration issues with pngdeflate,
which requires both the correct libpng and the correct zlib to function
correctly.
2013-05-08 14:21:46 -05:00
John Bowler
294d0b8408 [libpng16] Detect wrong libpng versions linked to pngdeflate, which currently
only works with libpng versions that can be made to reliably fail when
    the deflate data contains an out-of-window reference.  This means only
    1.6 and later.
  Fixed gnu issues: g++ needs a static_cast, gcc 4.4.7 has a broken warning
    message which it is easier to work round than ignore.
2013-05-08 08:56:45 -05:00
Glenn Randers-Pehrson
62c6fbbd29 [libpng16] Check that PNG_MAXIMUM_INFLATE_WINDOW is defined before using it. 2013-05-07 23:16:06 -05:00
John Bowler
0c7ac064d3 [libpng16] Added an option to force maximum window size for inflating.
For inflate, reverted previous fixes.
Added fixitxt and pngdeflate to the built programs and removed warnings
from the source code and timepng that are revealed as a result.  Fixed
fixitxt when the chunk length is more than 65535 (untested, no test case).
2013-05-07 21:59:05 -05:00
Glenn Randers-Pehrson
db67cba8d4 [libpng16] Check for EOF in contrib/pngminus/pnm2png.c (Paul Stewart).
Ignore "#" delimited comments in input file to pnm2png.c.
2013-05-07 14:31:35 -05:00
Glenn Randers-Pehrson
2fd3434fa4 [libpng16] Imported from libpng-1.6.3beta04.tar 2013-05-06 09:55:18 -05:00
Glenn Randers-Pehrson
127b08a265 [libpng16] Calculate our own zlib windowBits when decoding rather than
trusting the CMF bytes in the PNG datastream.
2013-05-05 22:13:47 -05:00
Glenn Randers-Pehrson
399430dac2 [libpng16] Update "last changed" comments. 2013-04-25 09:52:00 -05:00
Glenn Randers-Pehrson
3f677d1c65 [libpng16] Bump version to 1.6.3beta01 2013-04-25 09:19:04 -05:00
Glenn Randers-Pehrson
809355b4aa [libpng16] Imported from libpng-1.6.2.tar 2013-04-25 07:29:41 -05:00
Glenn Randers-Pehrson
6e1c74b39b [libpng16] Imported from libpng-1.6.2rc03.tar 2013-04-22 11:36:05 -05:00
Glenn Randers-Pehrson
67a289ffa9 [libpng16] Fixed some spelling/typos 2013-04-19 19:03:34 -05:00
Glenn Randers-Pehrson
7ef0c46488 [libpng16] Updated "last changed" comments. 2013-04-18 07:25:45 -05:00
John Bowler
43c07e1b48 [libpng16] Fixed incorrect warning of excess deflate data. End condition - the
warning would be produced if the end of the deflate stream wasn't read
in the last row.  The warning is harmless.
2013-04-07 21:33:30 -05:00
Glenn Randers-Pehrson
5087805e7c [libpng16] Imported from libpng-1.6.1.tar 2013-03-27 20:36:57 -05:00
John Bowler
caa3f296df [libpng16] Eliminated another warning from the Intel C compiler. 2013-03-10 21:40:27 -05:00
John Bowler
2286a7cef4 [libpng16] Eliminated a warning from the Intel C compiler. The warning is
technically valid, although a reasonable treatment of division would
show it to be incorrect.
2013-03-10 21:35:35 -05:00
Glenn Randers-Pehrson
8c87dc88d6 [libpng16] Imported from libpng-1.6.1beta06.tar 2013-03-04 17:56:46 -06:00
Glenn Randers-Pehrson
4ea113b7f0 [libng16] Reverted recent change that eliminated a warning about storing
an unhandled chunk.
2013-03-02 16:03:45 -06:00
Glenn Randers-Pehrson
871b1d0fab [libpng16] Bump version to 1.6.1beta05 2013-03-02 15:03:15 -06:00
Glenn Randers-Pehrson
f3af706c2a [libpng16] Imported from libpng-1.6.0beta05.tar 2013-03-01 21:38:03 -06:00
Glenn Randers-Pehrson
96cf4bde0e [libpng16] Fixed bug introduced in libpng-1.6.0beta28 that causes libpng to
handle chunks even when they have been tagged PNG_HANDLE_CHUNK_NEVER.
2013-03-01 20:04:06 -06:00
Glenn Randers-Pehrson
adb9613699 [libpng16] Imported from libpng-1.6.1beta02.tar 2013-02-18 21:25:47 -06:00
Glenn Randers-Pehrson
3b8e7e869d [libpng16] Imported from libpng-1.6.1beta01.tar 2013-02-16 10:48:29 -06:00
Glenn Randers-Pehrson
5851280929 [libpng16] Imported from libpng-1.6.0beta37.tar 2013-01-10 12:20:59 -06:00
John Bowler
6cf32b460f [libpng16] Rearranged the ARM-NEON optimizations: Isolated the machine specific
code to the hardware subdirectory and added comments to pngrutil.c so that
implementors of other optimizations know what to do.
2012-12-15 07:55:54 -06:00
John Bowler
f758d6c813 [libpng16] Rearranged the ARM-NEON optimizations: Isolated the machine specific
code to the hardware subdirectory and added comments to pngrutil.c so that
implementors of other optimizations know what to do.
2012-12-13 11:26:50 -06:00
Glenn Randers-Pehrson
5b9a28f2b8 [libpng16] Trivial editing of commentary in pngrutil.c 2012-11-25 12:46:24 -06:00
John Bowler
520803d57e [libpng16] Removed non-working ICC profile support code. There was too much
code for too little gain; implementing full ICC color correction is maybe
desireable but is left up to applications.
2012-11-01 08:12:47 -05:00
John Bowler
f8dfd123e2 [libpng16] Changed ICC profile support to allow use of an external color
management system (CMS). In practice it is not possible to obtain cHRM
information reliably using just the end-point tags because they do not exist
in the vast majority of profiles.  Instead it is necessary to run the endpoints
through the ICC colorimetric intent transform (as described in the v4
spec).  Since this is likely to be too much code inside libpng for too
little gain (it implies a fairly complete CMS implementation) the code
has been changed to allow an external CMS to be used.  This code is
temporarily disabled until a suitable set of test cases using one or more
external CMS implementations have been implemented.
2012-10-25 19:30:02 -05:00
John Bowler
b98681b49a [libpng16] Improved ICC profile handling including cHRM chunk generation and
fixed Cygwin+MSVC build errors. The ICC profile handling now includes more
checking.  Several errors that caused rejection of the profile are now
handled with a warning in such a way that the invalid profiles will be
read by default in release (but not pre-RC) builds but will not be
written by default.  The easy part of handling a cHRM chunk is written,
where the ICC profile contains the required data.  The more difficult
part plus guessing a gAMA value requires code to pass selected RGB values
through the profile.
2012-09-04 16:35:20 -05:00
John Bowler
14d0ca620e [libpng16] Cleaned up and corrected ICC profile handling.
contrib/libtests/makepng: corrected 'rgb' and 'gray' cases.  profile_error
    messages could be truncated; made a correct buffer size calculation and
    adjusted pngerror.c appropriately. png_icc_check_* checking improved;
    changed the functions to receive the correct color type of the PNG on read
    or write and check that it matches the color space of the profile (despite
    what the comments said before, there is danger in assuming the app will
    cope correctly with an RGB profile on a grayscale image and, since it
    violates the PNG spec, allowing it is certain to produce inconsistent
    app behavior and might even cause app crashes.) Check that profiles
    contain the tags needed to process the PNG (tags all required by the ICC
    spec). Removed unused PNG_STATIC from pngpriv.h.
2012-08-25 16:21:46 -05:00
John Bowler
d0eef28ee1 [libpng16] Added "tunknown" test and corrected a logic error in
png_handle_unknown() when SAVE support is absent.  Moved the shell test
scripts for contrib/libtests from the libpng top directory to contrib/libtests.
png_handle_unknown() must always read or skip the chunk, if
SAVE_UNKNOWN_CHUNKS is turned off *and* the application does not set
a user callback an unknown chunk will not be read, leading to a read
error, which was revealed by the "tunknown" test.
2012-08-17 15:30:29 -05:00
John Bowler
4a6c6df6c7 [libpng16] Allow fine grain control of unknown chunk APIs. This change allows
png_set_keep_unknown_chunks() to be turned off if not required and causes
both read and write to behave appropriately (on read this is only possible
if the user callback is used to handle unknown chunks).  The change
also removes the support for storing unknown chunks in the info_struct
if the only unknown handling enabled is via the callback, allowing libpng
to be configured with callback reading and none of the unnecessary code.
2012-08-16 16:12:13 -05:00
John Bowler
e9567514dd [libpng16] Unknown handling fixes and clean up. This adds more correct option
control of the unknown handling, corrects the pre-existing bug where
the per-chunk 'keep' setting is ignored and makes it possible to skip
IDAT chunks in the sequential reader (broken in earlier 1.6 versions).
There is a new test program, test-unknown.c, which is a work in progress
(not currently part of the test suite).  Comments in the header files now
explain how the unknown handling works.
2012-08-15 22:53:00 -05:00
Glenn Randers-Pehrson
3744f94fd1 [libpng16] Removed trailing blanks 2012-08-10 19:22:53 -05:00
Glenn Randers-Pehrson
ece07cfe9c [libpng16] Removed the png_sizeof(), png_strlen(), png_memset(), png_memcpy(),
and png_memcmp() macros.
2012-08-10 18:19:41 -05:00
Glenn Randers-Pehrson
dbb7e19fda [libpng16] Consistently use memset(), memcpy(), and memcmp() instead of the
png_memset(), png_memcpy(), and png_memcmp() macros.
2012-08-10 17:27:42 -05:00
Glenn Randers-Pehrson
26849f4693 [libpng16] Consistently use png_memset(), png_memcpy(), and png_memcmp(),
except in pngtest.c and example.c where these macros are not visible.
2012-08-10 16:01:45 -05:00
Glenn Randers-Pehrson
4430b91363 [libpng16] Restore info_ptr members that were deleted by the previous
patch; they are needed by png_set_IHDR() for both read and write.  Fix
some ifdefs that caused the contrib/pngminim/ applications to not compile.
2012-08-09 22:24:04 -05:00
Glenn Randers-Pehrson
432c174b64 [libpng16] Eliminated use of png_sizeof(); use sizeof() instead, and use.
a consistent style for (sizeof type) and (sizeof (array))
2012-08-09 20:14:48 -05:00
John Bowler
b45416921b [libpng16] Removed need for -Wno-cast-align with clang. clang correctly warns
on alignment increasing pointer casts when -Wcast-align is passed. This
fixes the cases clang warns about either (pngread.c) by eliminating the
casts from png_bytep to png_uint_16p or, for pngrutil.c where the cast
is previously verified or pngstest.c where it is OK by introducing new
png_aligncast macros to do the cast in a way that clang accepts.
2012-04-30 06:31:54 -05:00
John Bowler
921648a997 [libpng16] Recognize known sRGB ICC profiles while reading; prefer writing the
iCCP profile over writing the sRGB chunk, controlled by the
    PNG_sRGB_PROFILE_CHECKS option.
2012-03-28 23:36:12 -05:00
Glenn Randers-Pehrson
48015617d3 [libpng16] Recognize known sRGB ICC profiles while reading and issue a warning
about it, if PNG_WARN_IF_iCCP_IS_sRGB_SUPPORTED is defined.
2012-03-28 10:58:01 -05:00
John Bowler
13a87d9682 [libpng16] Fixed ICC profile parsing and sRGB profile recognition
and moved checksum-icc.c from contrib/libtests to contrib/tools.
2012-03-28 09:51:43 -05:00
John Bowler
f7677a348e [libpng16] Use uLong 64 bits for crc32 return in profile check 2012-03-21 23:52:41 -05:00
Glenn Randers-Pehrson
8fbd60ded2 [libpng16] Recognize known sRGB ICC profiles while reading and handle them as
if the sRGB chunk had appeared instead.
2012-03-21 09:18:15 -05:00
John Bowler
b11b31aea2 [libpng16] Changed chunk handler warnings into benign errors, incrementally
load iCCP
2012-03-21 07:55:46 -05:00
John Bowler
66efa24241 [libpng16] Removed erroneous setting of DETECT_UNINITIALIZED and added more
checks. The code now does a png_error if an attempt is made to do the
row initialization twice; this is an application error and it has
serious consequences because the transform data in png_struct is
changed by each call.
2012-03-18 21:10:29 -05:00
John Bowler
0c11b5f8e7 [libpng16] Work around for duplicate row start calls; added warning messages.
This turns on PNG_FLAG_DETECT_UNINITIALIZED to detect app code that
fails to call one of the 'start' routines (not enabled in libpng-1.5
because it is technically an API change, since it did normally work
before.)  It also makes duplicate calls to png_read_start_row (an
internal function called at the start of the image read) benign, as
they were before changes to use png_inflate_claim. Somehow webkit is
causing this to happen; this is probably a mis-feature in the zlib
changes so this commit is only a work-round.
2012-03-18 14:39:41 -05:00
John Bowler
aa816c4444 [libpng16] Added configuration support for benign errors and changed the read
default. Also changed some warnings in the iCCP and sRGB handling
from to benign errors. Configuration now makes read benign
errors warnings and write benign errors to errors by default (thus
changing the behavior on read).  The simplified API always forces
read benign errors to errors (regardless of the system default, unless
this is disabled in which case the simplified API can't be built.)
2012-03-16 07:39:49 -05:00
John Bowler
9066919600 [libpng16] If benign errors are disabled use maximum window on ancillary
inflate.  This works round a bug introduced in 1.5.4 where compressed ancillary
chunks could end up with a too-small windowBits value in the deflate
header.
2012-03-09 22:03:13 -06:00
John Bowler
b5d0051dcb [libpng16] Deflate/inflate was reworked to move common zlib calls into single
functions [rw]util.c.  A new shared keyword check routine was also added
and the 'zbuf' is no longer allocated on progressive read.  It is now
possible to call png_inflate() incrementally.
2012-03-09 09:15:18 -06:00
Glenn Randers-Pehrson
6038b80277 [libpng16] Reject iCCP chunk after the first, even if the first one is invalid. 2012-03-08 10:40:07 -06:00
John Bowler
42a2b556e9 [libpng16] Made read 'inflate' handling like write 'deflate' handling. The
read code now claims and releases png_ptr->zstream, like the write code.
The bug whereby the progressive reader failed to release the zstream
is now fixed, all initialization is delayed, and the code checks for
changed parameters on deflate rather than always calling
deflatedEnd/deflateInit.
2012-03-05 20:57:40 -06:00
John Bowler
0ae4f7b705 [libpng16] Changed png_inflate() and calling routines to avoid overflow
problems.  This is an intermediate check-in that solves the immediate problems
and introduces one performance improvement (avoiding a copy via png_ptr->zbuf.)
Further changes will be made to make ICC profile handling more secure.
2012-03-03 21:10:26 -06:00
John Bowler
6f237b6bf0 [libpng16] Remove whitespace at end of lines 2012-03-02 13:20:52 -06:00
John Bowler
8fb6c6a9b3 [libpng16] Eliminated Intel icc/icl compiler warnings. The Intel (GCC derived)
compiler issues slightly different warnings from those issued by the
current vesions of GCC. This eliminates those warnings by
adding/removing casts and small code rewrites.
2012-01-25 07:47:44 -06:00
Glenn Randers-Pehrson
1531bd61a0 [libpng16] Updated copyright year to 2012 2012-01-01 14:45:04 -06:00
John Bowler
5d56786eff [libpng16] Implemented 'restrict' for png_info and png_struct.
Added new "png_structrp" typedef. Because of the
way libpng works both png_info and png_struct are always accessed via a
single pointer.  This means adding C99 'restrict' to the pointer gives
the compiler some opportunity to optimize the code.  This change allows that.
2011-12-24 09:12:00 -06:00