Commit Graph

435 Commits

Author SHA1 Message Date
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
Glenn Randers-Pehrson
945cb1f9be [libpng16] Issue a png_benign_error() instead of png_warning() about bad
palette index.
2012-03-10 08:48:04 -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
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
Glenn Randers-Pehrson
eeb1bb678d [libng16] Added palette-index checking while writing.
Relocated palette-index checking function from pngrutil.c to pngtrans.c
2012-03-02 22:10:15 -06:00
John Bowler
6f237b6bf0 [libpng16] Remove whitespace at end of lines 2012-03-02 13:20:52 -06:00
Glenn Randers-Pehrson
5408b613f8 [libpng16] Removed unused "current_text" members of png_struct
and the png_free() of png_ptr->current_text from pngread.c
2012-02-27 08:09:42 -06:00
Glenn Randers-Pehrson
a4badc4b50 [libpng16] Imported from libpng-1.6.0beta12.tar 2012-02-17 17:07:54 -06:00
Glenn Randers-Pehrson
b0606ea043 [libpng16] Increase num_palette to invalid_index + 1, not to invalid_index. 2012-02-16 20:48:28 -06:00
Glenn Randers-Pehrson
67dba43998 [libpng16] Check for invalid palette index while reading paletted PNG. When
one is found, issue a warning and increase png_ptr->num_palette accordingly.
Apps are responsible for checking to see if that happened.
2012-02-16 20:15:13 -06:00
Glenn Randers-Pehrson
864270e18f [libpng16] Fixed a memory overwrite bug in simplified read of RGB PNG with
Fixed a memory overwrite bug in simplified read of RGB PNG with
non-linear gamma Also bugs in the error checking in pngread.c and changed
quite a lot of the checks in pngstest.c to be correct; either correctly
written or not over-optimistic.  The pngstest changes are insufficient to
allow all possible RGB transforms to be passed; pngstest cmppixel needs
to be rewritten to make it clearer which errors it allows and then changed
to permit known inaccuracies.
2012-02-10 17:13:13 -06:00
John Bowler
40ca77a721 [libpng16] Improved pngstest speed by not doing redundant tests and add const
to the background parameter of png_image_finish_read. The --background
option is now done automagically only when required, so that commandline
option no longer exists.
2012-01-28 23:19:42 -06:00
John Bowler
5bc90389bf [libpng16] Added color-map support to simplified API.
This is an initial version for review; the documentation has not yet been
updated.
2012-01-23 22:43:22 -06:00
John Bowler
04336ba10f [libpng16] Add palette support to the simplified APIs. This commit
changes some of the macro definitions in png.h, app code may need
corresponding changes.
2012-01-16 07:48:36 -06:00
Glenn Randers-Pehrson
1531bd61a0 [libpng16] Updated copyright year to 2012 2012-01-01 14:45:04 -06:00
John Bowler
4f67e40898 [libpng16] Add 'const' to png_structrp arguments of png_set_*() APIs.
Because these APIs store to the png_info they can take a
 png_const_structrp now that the error routines also accept
 one of these.
2011-12-28 08:43:37 -06:00
Glenn Randers-Pehrson
a5bf4e3767 [libpng16] Initialize "passes" variable in pngread.c to avoid compiler warning.
It was not actually possible to use it uninitialized but gcc doesn't know that.
2011-12-24 09:27:20 -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
John Bowler
40b2603687 [libpng16] Start-up code size improvements, error handler flexibility. These
changes alter how the tricky allocation of the initial png_struct and png_info
structures are handled. png_info is now handled in pretty much the same
way as everything else, except that the allocations handle NULL return
silently.  png_struct is changed in a similar way on allocation and on
deallocation a 'safety' error handler is put in place (which should never
be required).  The error handler itself is changed to permit mismatches
in the application and libpng error buffer size; however, this means a
silent change to the API to return the jmp_buf if the size doesn't match
the size from the libpng compilation; libpng now allocates the memory and
this may fail.  Overall these changes result in slight code size
reductions; however, this is a reduction in code that is always executed
so is particularly valuable.  Overall on a 64-bit system the libpng DLL
decreases in code size by 1733 bytes.  pngerror.o increases in size by
about 465 bytes because of the new functionality.
2011-12-22 08:09:15 -06:00
John Bowler
1d7f56ab64 [libpng16] Failed to commit pngread.c from latest patch. 2011-12-21 20:14:23 -06:00
Glenn Randers-Pehrson
13831bc06e [libpng16] Updated "last changed" dates 2011-12-21 08:28:28 -06:00
John Bowler
baeb6d1e92 [libpng16] Added ANSI-C (C90) headers; eliminated the use of FAR/far. 2011-11-26 18:21:02 -06:00
Glenn Randers-Pehrson
7455cbf47e [libpng16] Update internal version numbering and SO-numbers 2011-11-24 14:49:01 -06:00
John Bowler
3706d730d1 [libpng15] Allow row_stride==0 to indicate default stride in simplified API 2011-11-21 10:28:06 -06:00
John Bowler
4fa96a42f7 [libpng15] Fixes for C++ compilation using g++ When libpng source is compiled
using g++. The compiler imposes C++ rules on the C source; thus it
    is desireable to make the source work with either C or C++ rules
    without throwing away useful error information.  This change adds
    png_voidcast to allow C semantic (void*) cases or the corresponding
    C++ static_cast operation, as appropriate.
2011-11-16 16:39:16 -06:00
John Bowler
18c5cfafeb [libpng15] Multiple transform bug fixes plus a work-round for double gamma
correction.
2011-11-16 14:26:34 -06:00
John Bowler
89c2f84287 [libpng15] Fix Windows builds, add pngstest to Visual Studio and OpenWatcom 2011-11-16 12:04:39 -06:00
Glenn Randers-Pehrson
6d8e090419 [libpng15] Imported from libpng-1.5.7beta02.tar 2011-11-11 20:06:18 -06:00
Glenn Randers-Pehrson
d3feb52955 [libpng15] Ignore unused chunks in the new simplified read API. 2011-11-11 17:20:34 -06:00
Glenn Randers-Pehrson
84b0da9c94 [libpng15] Updated commentary about new API 2011-11-10 06:32:19 -06:00
John Bowler
e6fb691c49 [libpng15] Fixes to alpha swap on read, simplified write and filler add code 2011-11-08 21:35:16 -06:00
John Bowler
3615d03e05 [libpng15] Fix PNG_SIMPLIFIED transformations,
adding alpha and reducing to 8-bit
2011-11-08 10:38:09 -06:00
Glenn Randers-Pehrson
efc4b69767 [libpng15] Fixed some typos in comments. 2011-11-07 23:31:34 -06:00
John Bowler
7875d534cb [libpng15] Simplified read/write API initial version; basic read/write tested
on a variety of images, limited documentation (in the header file.)
2011-11-07 22:33:49 -06:00
Glenn Randers-Pehrson
55e85c24b4 [libpng15] Imported from libpng-1.5.7beta01.tar 2011-11-04 13:47:49 -05:00
Mans Rullgard
d3a94802d8 [libpng15] Added support for ARM processor (Mans Rullgard) 2011-11-03 00:47:55 -05:00
Glenn Randers-Pehrson
2b7d730e27 [libpng15] Bump version to libpng-1.5.7beta01 2011-11-02 23:14:13 -05:00
Glenn Randers-Pehrson
bc6726bc04 [libpng15] Imported from libpng-1.5.6.tar 2011-11-02 22:48:36 -05:00
Mans Rullgard
1c42276a39 [libpng15] New png_struct member png_ptr->old_prev_row 2011-10-17 16:52:19 -05:00
John Bowler
07772cba07 [libpng15] Fixes for multiple calls to png_read_update_info.
These fixes attend to most of the errors revealed in pngvalid, however doing
the gamma work twice results in inaccuracies that can't be easily fixed.
There is now a warning in the code if this is going to happen.
2011-10-14 18:19:47 -05:00
Glenn Randers-Pehrson
3dbfd300ff [libpng15] Removed two redundant tests for unitialized row. 2011-10-13 17:24:36 -05:00
Glenn Randers-Pehrson
65c0339b5c [libpng15] Speed up png_combine_row() for interlaced images. This reduces the
generality of the code, allowing it to be optimized for Adam7 interlace.  The
masks passed to png_combine_row() are now generated internally, avoiding
some code duplication and localizing the interlace handling somewhat.
2011-10-06 21:54:17 -05:00
Glenn Randers-Pehrson
bb5cb1476b [libpng15] Bump version to libpng-1.5.6beta02 2011-09-22 12:48:19 -05:00
Glenn Randers-Pehrson
d404b6d488 [devel] Imported from libpng-1.5.4.tar 2011-07-07 06:26:30 -05:00
John Bowler
8d261262d9 [devel] Fixed pngvalid, simplified macros, added checking for 0 in sCAL. 2011-06-18 13:37:11 -05:00
Glenn Randers-Pehrson
aee83b43d6 [devel] Fixed buffer bug (both the strip_16 and scale_16 transforms were
being applied.
2011-06-18 00:19:54 -05:00
Glenn Randers-Pehrson
6da2f2d92a [devel] Fix more inconsistencies from the swap of 16_TO_8 APIs.
pngvalid still fails.
2011-06-17 23:07:16 -05:00