summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schröder <martin@oneiros.de>2008-05-08 13:35:52 +0000
committerMartin Schröder <martin@oneiros.de>2008-05-08 13:35:52 +0000
commitd805a01f2ef4c95c64ee2fcd28de2be8f7739886 (patch)
tree87531a5e686ee9fee2bcb94eeea91631b392e884
parent151f5e5cae3fca2c5d0e491407c0fe3a30a9b51e (diff)
libpng 1.2.29
git-svn-id: svn://tug.org/texlive/trunk@7939 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/libs/libpng/ANNOUNCE69
-rw-r--r--Build/source/libs/libpng/CHANGES90
-rw-r--r--Build/source/libs/libpng/INSTALL16
-rw-r--r--Build/source/libs/libpng/KNOWNBUG2
-rw-r--r--Build/source/libs/libpng/LICENSE4
-rw-r--r--Build/source/libs/libpng/README16
-rw-r--r--Build/source/libs/libpng/Y2KINFO4
-rw-r--r--Build/source/libs/libpng/libpng-1.2.29.txt (renamed from Build/source/libs/libpng/libpng-1.2.25.txt)81
-rw-r--r--Build/source/libs/libpng/libpng.3109
-rw-r--r--Build/source/libs/libpng/libpngpf.34
-rw-r--r--Build/source/libs/libpng/png.54
-rw-r--r--Build/source/libs/libpng/png.c4
-rw-r--r--Build/source/libs/libpng/png.h42
-rw-r--r--Build/source/libs/libpng/pngconf.h2
-rw-r--r--Build/source/libs/libpng/pnggccrd.c4
-rw-r--r--Build/source/libs/libpng/pngmem.c8
-rw-r--r--Build/source/libs/libpng/pngpread.c13
-rw-r--r--Build/source/libs/libpng/pngrtran.c19
-rw-r--r--Build/source/libs/libpng/pngrutil.c55
-rw-r--r--Build/source/libs/libpng/pngset.c83
-rw-r--r--Build/source/libs/libpng/pngtest.c21
-rw-r--r--Build/source/libs/libpng/pngwrite.c4
-rw-r--r--Build/source/libs/libpng/pngwutil.c26
23 files changed, 479 insertions, 201 deletions
diff --git a/Build/source/libs/libpng/ANNOUNCE b/Build/source/libs/libpng/ANNOUNCE
index afa31b92885..5580fb8b4c9 100644
--- a/Build/source/libs/libpng/ANNOUNCE
+++ b/Build/source/libs/libpng/ANNOUNCE
@@ -1,5 +1,5 @@
-Libpng 1.2.25 - February 18, 2008
+Libpng 1.2.29 - May 8, 2008
This is a public release of libpng, intended for use in production codes.
@@ -8,59 +8,50 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
- libpng-1.2.25.tar.gz
- libpng-1.2.25.tar.lzma
+ libpng-1.2.29.tar.gz
+ libpng-1.2.29.tar.lzma
(Get the lzma codec from <http://tukaani.org/lzma>).
- libpng-1.2.25.tar.bz2
+ libpng-1.2.29.tar.bz2
Source files with LF line endings (for Unix/Linux) without the
"configure" script
- libpng-1.2.25-no-config.tar.gz
- libpng-1.2.25-no-config.tar.lzma
- libpng-1.2.25-no-config.tar.bz2
+ libpng-1.2.29-no-config.tar.gz
+ libpng-1.2.29-no-config.tar.lzma
+ libpng-1.2.29-no-config.tar.bz2
Source files with CRLF line endings (for Windows), without the
"configure" script
- lpng1225.zip
- lpng1225.7z
- lpng1225.tar.bz2
+ lpng1229.zip
+ lpng1229.7z
+ lpng1229.tar.bz2
Project files
- libpng-1.2.25-project-netware.zip
- libpng-1.2.25-project-wince.zip
+ libpng-1.2.29-project-netware.zip
+ libpng-1.2.29-project-wince.zip
Other information:
- libpng-1.2.25-README.txt
- libpng-1.2.25-KNOWNBUGS.txt
- libpng-1.2.25-LICENSE.txt
- libpng-1.2.25-Y2K-compliance.txt
- libpng-1.2.25-1.2.24-diff.txt
-
-Changes since the last public release (1.2.24):
-
-version 1.2.25 [February 18, 2008]
-
- Fixed bug with unknown chunk handling, introduced in version 1.2.17
- Prevent gamma from being applied twice.
- Fixed some continue-after-malloc-failure errors in pngset.c (David Hill)
- Check for info_ptr == NULL in png_read_info() and png_process_data().
- Check for possible use of NULL user_png_ver[] in png_create_read_struct().
- Fix overflow of "msg" in png_decompres_chunk().
- Added libpng-1.2.25.tar.lzma to distribution. Get the lzma codec
- from <http://tukaani.org/lzma>.
- Added lpng1225.7z to distribution. Get the 7-zip decoder from
- from <http://www.7-zip.org>.
- Fixed some broken links in the README file.
- Refactored png_read_push_finish_row() slightly, trying to satisfy Coverity.
- Fixed potential NULL dereference of png_ptr in png_destroy_write_struct();
- clarified potential NULL dereference of png_ptr in png_destroy_read_struct();
- fixed potential NULL dereference of info_ptr in png_handle_bKGD();
- fixed potential NULL dereference of user_png_ver[] in
- png_create_write_struct_2(). (Coverity)
+ libpng-1.2.29-README.txt
+ libpng-1.2.29-KNOWNBUGS.txt
+ libpng-1.2.29-LICENSE.txt
+ libpng-1.2.29-Y2K-compliance.txt
+ libpng-1.2.29-[previous version]-diff.txt
+
+Changes since the last public release (1.2.28):
+
+version 1.2.29 [May 8, 2008]
+
+ Removed some stray *.diff and *.orig files
+ Reverted Makefile.in, aclocal.m4, and configure to the libpng-1.2.26
+ versions.
+ Added --force to autogen libtoolize options and --force-missing to
+ automake options.
+ Changed $(ECHO) to echo in Makefile.am and Makefile.in
+ Updated all configure files to autoconf-2.62
+ #ifdef out pnggcrd.c code if using MSC_VER
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
diff --git a/Build/source/libs/libpng/CHANGES b/Build/source/libs/libpng/CHANGES
index 7cee1a4607f..590987c79c8 100644
--- a/Build/source/libs/libpng/CHANGES
+++ b/Build/source/libs/libpng/CHANGES
@@ -2048,7 +2048,7 @@ version 1.2.25beta03 [January 22, 2008]
Change "if (swidth == NULL)" to "if (sheight == NULL)" in png_handle_sCAL
(bug introduced in libpng-1.2.4/1.0.13).
Return from png_destroy_read_struct() if png_ptr_ptr is NULL.
- Fix overflow of "msg" in png_decompres_chunk().
+ Fix overflow of "msg" in png_decompress_chunk().
version 1.2.25beta04 [January 26, 2008]
Work around Coverity bug report by slightly refactoring
@@ -2076,6 +2076,94 @@ version 1.2.25rc02 [February 10, 2008]
version 1.2.25 and 1.0.31 [February 18, 2008]
No changes.
+version 1.2.26beta01 [February 21, 2008]
+ Added missing "(" in pngmem.c. Bug introduced in libpng-1.2.2/1.0.13
+
+version 1.2.26beta02 [March 12, 2008]
+ Refined error message returned from deflateInit2 in pngwutil.c
+ Check IHDR length in png_push_read_chunk() before saving it.
+
+version 1.2.26beta03 [March 16, 2008]
+ Revised contrib/gregbook to handle premature end-of-file and file
+ read errors correctly.
+
+version 1.2.26beta04 [March 18, 2008]
+ Free png_ptr->big_row_buf and png_ptr->prev_row before allocating
+ new copies in png_read_start_row(). Bug introduced in libpng-1.2.22.
+
+version 1.2.26beta05 [March 19, 2008]
+ Removed extra png_free() added in libpng-1.2.26beta04.
+
+version 1.2.26beta06 [March 19, 2008]
+ Avoid reallocating big_row_buf and prev_row when the size does not increase.
+
+version 1.2.26rc01 [March 26, 2008]
+ Ifdef out some code that is unused when interlacing is not supported.
+
+versions 1.0.32 and 1.2.26 [April 2, 2008]
+ No changes.
+
+version 1.2.27beta01 [April 12, 2008]
+ Fixed bug (introduced in libpng-1.0.5h) with handling zero-length
+ unknown chunks.
+ Added more information about png_set_keep_unknown_chunks() to the
+ documetation.
+ Reject tRNS chunk with out-of-range samples instead of masking off
+ the invalid high bits as done in since libpng-1.2.19beta5.
+
+version 1.2.27beta02 [April 13, 2008]
+ Revised documentation about unknown chunk and user chunk handling.
+ Keep tRNS chunk with out-of-range samples and issue a png_warning().
+
+version 1.2.27beta03 [April 14, 2008]
+ Added check for NULL ptr in TURBOC version of png_free_default().
+ Removed several unnecessary checks for NULL before calling png_free().
+ Revised png_set_tRNS() so that calling it twice removes and invalidates
+ the previous call.
+ Revised pngtest to check for out-of-range tRNS samples.
+
+version 1.2.27beta04 [April 18, 2008]
+ Added AC_LIBTOOL_WIN32_DLL to configure.ac
+ Rebuilt Makefile.in, aclocal.m4, and configure with autoconf-2.62
+
+version 1.2.27beta05 [April 19, 2008]
+ Added MAINTEINERCLEANFILES variable to Makefile.am
+
+version 1.2.27beta06 [April 21, 2008]
+ Avoid changing color_type from GRAY to RGB by
+ png_set_expand_gray_1_2_4_to_8().
+
+version 1.2.27rc01 [April 23, 2008]
+ Fix broken URL for rfc2083 in png.5 and libpng-*.txt
+
+version 1.0.33 and 1.2.27 [April 30, 2008]
+ No changes.
+
+version 1.0.34 and 1.2.28 [April 30, 2008]
+ Rebuilt Makefile.in, aclocal.m4, and configure with autoconf-2.61
+ due to backward incompatibilities.
+ Removed a stray object file from contrib/gregbook
+
+version 1.2.29beta01 [May 1, 2008]
+ Removed some stray *.diff and *.orig files
+
+version 1.2.29beta02 [May 1, 2008]
+ Reverted Makefile.in, aclocal.m4, and configure to the libpng-1.2.26
+ versions.
+
+version 1.2.29beta03 [May 2, 2008]
+ Added --force to autogen libtoolize options and --force-missing to
+ automake options.
+ Changed $(ECHO) to echo in Makefile.am and Makefile.in
+ Updated all configure files to autoconf-2.62
+ #ifdef out pnggcrd.c code if using MSC_VER
+
+version 1.2.29rc01 [May 4, 2008]
+ No changes.
+
+version 1.0.35 and 1.2.29 [May 8, 2008]
+ No changes.
+
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/Build/source/libs/libpng/INSTALL b/Build/source/libs/libpng/INSTALL
index 3ab8f42f72f..6060e31294c 100644
--- a/Build/source/libs/libpng/INSTALL
+++ b/Build/source/libs/libpng/INSTALL
@@ -1,5 +1,5 @@
-Installing libpng version 1.2.25 - February 18, 2008
+Installing libpng version 1.2.29 - May 8, 2008
On Unix/Linux and similar systems, you can simply type
@@ -44,7 +44,7 @@ to have access to the zlib.h and zconf.h include files that
correspond to the version of zlib that's installed.
You can rename the directories that you downloaded (they
-might be called "libpng-1.2.25" or "lpng109" and "zlib-1.2.1"
+might be called "libpng-1.2.29" or "lpng109" and "zlib-1.2.1"
or "zlib121") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
@@ -101,9 +101,9 @@ include
CMakeLists.txt => "cmake" script
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning,
- gcc, creates libpng12.so.0.1.2.25)
+ gcc, creates libpng12.so.0.1.2.29)
makefile.linux => Linux/ELF makefile
- (gcc, creates libpng12.so.0.1.2.25)
+ (gcc, creates libpng12.so.0.1.2.29)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
@@ -125,14 +125,14 @@ include
makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc,
- creates libpng12.so.0.1.2.25)
+ creates libpng12.so.0.1.2.29)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc,
- creates libpng12.so.0.1.2.25)
+ creates libpng12.so.0.1.2.29)
makefile.solaris-x86 => Solaris/intelMMX 2.X makefile (gcc,
- creates libpng12.so.0.1.2.25)
+ creates libpng12.so.0.1.2.29)
makefile.so9 => Solaris 9 makefile (gcc,
- creates libpng12.so.0.1.2.25)
+ creates libpng12.so.0.1.2.29)
makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
diff --git a/Build/source/libs/libpng/KNOWNBUG b/Build/source/libs/libpng/KNOWNBUG
index a2f8458ea8f..7688a9ceb82 100644
--- a/Build/source/libs/libpng/KNOWNBUG
+++ b/Build/source/libs/libpng/KNOWNBUG
@@ -1,5 +1,5 @@
-Known bugs in libpng version 1.2.25
+Known bugs in libpng version 1.2.29
1. February 23, 2006: The custom makefiles don't build libpng with -lz.
diff --git a/Build/source/libs/libpng/LICENSE b/Build/source/libs/libpng/LICENSE
index 7f5c259be2b..072d9efec05 100644
--- a/Build/source/libs/libpng/LICENSE
+++ b/Build/source/libs/libpng/LICENSE
@@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
If you modify libpng you may insert additional notices immediately following
this sentence.
-libpng versions 1.2.6, August 15, 2004, through 1.2.25, February 18, 2008, are
+libpng versions 1.2.6, August 15, 2004, through 1.2.29, May 8, 2008, are
Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@@ -106,4 +106,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-February 18, 2008
+May 8, 2008
diff --git a/Build/source/libs/libpng/README b/Build/source/libs/libpng/README
index eb072aa52e8..fd2dbb1ad0a 100644
--- a/Build/source/libs/libpng/README
+++ b/Build/source/libs/libpng/README
@@ -1,11 +1,11 @@
-README for libpng version 1.2.25 - February 18, 2008 (shared library 12.0)
+README for libpng version 1.2.29 - May 8, 2008 (shared library 12.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
Libpng comes in several distribution formats. Get libpng-*.tar.gz,
libpng-*.tar.lzma, or libpng-*.tar.bz2 if you want UNIX-style line
-endings in the text files, or lpng*.7z lpng*.zip if you want DOS-style
+endings in the text files, or lpng*.7z or lpng*.zip if you want DOS-style
line endings.
Version 0.89 was the first official release of libpng. Don't let the
@@ -191,11 +191,11 @@ Files in this distribution:
descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning,
- gcc, creates libpng12.so.0.1.2.25)
+ gcc, creates libpng12.so.0.1.2.29)
makefile.linux => Linux/ELF makefile
- (gcc, creates libpng12.so.0.1.2.25)
+ (gcc, creates libpng12.so.0.1.2.29)
makefile.gcmmx => Linux/ELF makefile
- (gcc, creates libpng12.so.0.1.2.25,
+ (gcc, creates libpng12.so.0.1.2.29,
uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
@@ -217,12 +217,12 @@ Files in this distribution:
makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics
- (gcc, creates libpng12.so.0.1.2.25)
+ (gcc, creates libpng12.so.0.1.2.29)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
- (gcc, creates libpng12.so.0.1.2.25)
+ (gcc, creates libpng12.so.0.1.2.29)
makefile.so9 => Solaris 9 makefile
- (gcc, creates libpng12.so.0.1.2.25)
+ (gcc, creates libpng12.so.0.1.2.29)
makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
diff --git a/Build/source/libs/libpng/Y2KINFO b/Build/source/libs/libpng/Y2KINFO
index 075599c0d2c..43348df0f5f 100644
--- a/Build/source/libs/libpng/Y2KINFO
+++ b/Build/source/libs/libpng/Y2KINFO
@@ -1,13 +1,13 @@
Y2K compliance in libpng:
=========================
- February 18, 2008
+ May 8, 2008
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
- upward through 1.2.25 are Y2K compliant. It is my belief that earlier
+ upward through 1.2.29 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer
diff --git a/Build/source/libs/libpng/libpng-1.2.25.txt b/Build/source/libs/libpng/libpng-1.2.29.txt
index e922f24e467..91b98064751 100644
--- a/Build/source/libs/libpng/libpng-1.2.25.txt
+++ b/Build/source/libs/libpng/libpng-1.2.29.txt
@@ -1,13 +1,17 @@
libpng.txt - A description on how to use and modify libpng
- libpng version 1.2.25 - February 18, 2008
+ libpng version 1.2.29 - May 8, 2008
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2008 Glenn Randers-Pehrson
For conditions of distribution and use, see copyright
notice in png.h.
- based on:
+ Based on:
+
+ libpng versions 0.97, January 1998, through 1.2.29 - May 8, 2008
+ Updated and distributed by Glenn Randers-Pehrson
+ Copyright (c) 1998-2008 Glenn Randers-Pehrson
libpng 1.0 beta 6 version 0.96 May 28, 1997
Updated and distributed by Andreas Dilger
@@ -47,12 +51,14 @@ a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2003 (E)) at
The W3C and ISO documents have identical technical content.
The PNG-1.2 specification is available at
-<http://www.libpng.org/pub/png/documents/>
+<http://www.libpng.org/pub/png/documents/>. It is technically equivalent
+to the PNG specification (second edition) but has some additional material.
The PNG-1.0 specification is available
as RFC 2083 <http://www.libpng.org/pub/png/documents/> and as a
-W3C Recommendation <http://www.w3.org/TR/REC.png.html>. Some
-additional chunks are described in the special-purpose public chunks
+W3C Recommendation <http://www.w3.org/TR/REC.png.html>.
+
+Some additional chunks are described in the special-purpose public chunks
documents at <http://www.libpng.org/pub/png/documents/>.
Other information
@@ -260,15 +266,19 @@ input stream. You must supply the function
png_unknown_chunkp chunk);
{
/* The unknown chunk structure contains your
- chunk data: */
+ chunk data, along with similar data for any other
+ unknown chunks: */
+
png_byte name[5];
png_byte *data;
png_size_t size;
+
/* Note that libpng has already taken care of
the CRC handling */
- /* put your code here. Return one of the
- following: */
+ /* put your code here. Search for your chunk in the
+ unknown chunk structure, process it, and return one
+ of the following: */
return (-n); /* chunk had an error */
return (0); /* did not recognize */
@@ -288,6 +298,11 @@ you can retrieve with
png_get_user_chunk_ptr(png_ptr);
+If you call the png_set_read_user_chunk_fn() function, then all unknown
+chunks will be saved when read, in case your callback function will need
+one or more of them. This behavior can be changed with the
+png_set_keep_unknown_chunks() function, described below.
+
At this point, you can set up a callback function that will be
called after each row has been read, which you can use to control
a progress meter or the like. It's demonstrated in pngtest.c.
@@ -332,13 +347,13 @@ Unknown-chunk handling
Now you get to set the way the library processes unknown chunks in the
input PNG stream. Both known and unknown chunks will be read. Normal
behavior is that known chunks will be parsed into information in
-various info_ptr members; unknown chunks will be discarded. To change
+various info_ptr members while unknown chunks will be discarded. To change
this, you can call:
png_set_keep_unknown_chunks(png_ptr, keep,
chunk_list, num_chunks);
- keep - 0: do not handle as unknown
- 1: do not keep
+ keep - 0: default unknown chunk handling
+ 1: ignore; do not keep
2: keep only if safe-to-copy
3: keep even if unsafe-to-copy
You can use these definitions:
@@ -361,6 +376,37 @@ instances of png_set_keep_unknown_chunks(), the final instance will
take precedence. The IHDR and IEND chunks should not be named in
chunk_list; if they are, libpng will process them normally anyway.
+Here is an example of the usage of png_set_keep_unknown_chunks(),
+where the private "vpAg" chunk will later be processed by a user chunk
+callback function:
+
+ png_byte vpAg[5]={118, 112, 65, 103, (png_byte) '\0'};
+
+ #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+ png_byte unused_chunks[]=
+ {
+ 104, 73, 83, 84, (png_byte) '\0', /* hIST */
+ 105, 84, 88, 116, (png_byte) '\0', /* iTXt */
+ 112, 67, 65, 76, (png_byte) '\0', /* pCAL */
+ 115, 67, 65, 76, (png_byte) '\0', /* sCAL */
+ 115, 80, 76, 84, (png_byte) '\0', /* sPLT */
+ 116, 73, 77, 69, (png_byte) '\0', /* tIME */
+ };
+ #endif
+
+ ...
+
+ #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+ /* ignore all unknown chunks: */
+ png_set_keep_unknown_chunks(read_ptr, 1, NULL, 0);
+ /* except for vpAg: */
+ png_set_keep_unknown_chunks(read_ptr, 2, vpAg, 1);
+ /* also ignore unused known chunks: */
+ png_set_keep_unknown_chunks(read_ptr, 1, unused_chunks,
+ (int)sizeof(unused_chunks)/5);
+ #endif
+
+
The high-level read interface
At this point there are two ways to proceed; through the high-level
@@ -804,6 +850,7 @@ added. It expands the sample depth without changing tRNS to alpha.
At the same time, png_set_gray_1_2_4_to_8() was deprecated, and it
will be removed from a future version.
+
PNG can have files with 16 bits per channel. If you only can handle
8 bits per channel, this will strip the pixels down to 8 bit.
@@ -1743,6 +1790,11 @@ Some of the more important parts of the png_info are:
can also be
PNG_INTRAPIXEL_DIFFERENCING)
+If you call png_set_IHDR(), the call must appear before any of the
+other png_set_*() functions, which might require access to some of
+the IHDR settings. The remaining png_set_*() functions can be called
+in any order.
+
png_set_PLTE(png_ptr, info_ptr, palette,
num_palette);
palette - the palette for the file
@@ -2391,6 +2443,9 @@ Your malloc_fn() must return NULL in case of failure. The png_malloc()
function will normally call png_error() if it receives a NULL from the
system memory allocator or from your replacement malloc_fn().
+Your free_fn() will never be called with a NULL ptr, since libpng's
+png_free() checks for NULL before calling free_fn().
+
Input/Output in libpng is done through png_read() and png_write(),
which currently just call fread() and fwrite(). The FILE * is stored in
png_struct and is initialized via png_init_io(). If you wish to change
@@ -2796,13 +2851,13 @@ application:
IX. Y2K Compliance in libpng
-February 18, 2008
+May 8, 2008
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.2.25 are Y2K compliant. It is my belief that earlier
+upward through 1.2.29 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that
diff --git a/Build/source/libs/libpng/libpng.3 b/Build/source/libs/libpng/libpng.3
index ae397476e1d..ef7fc5b2b31 100644
--- a/Build/source/libs/libpng/libpng.3
+++ b/Build/source/libs/libpng/libpng.3
@@ -1,6 +1,6 @@
-.TH LIBPNG 3 "February 18, 2008"
+.TH LIBPNG 3 "May 8, 2008"
.SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.2.25
+libpng \- Portable Network Graphics (PNG) Reference Library 1.2.29
.SH SYNOPSIS
\fB
#include <png.h>\fP
@@ -410,14 +410,18 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
- libpng version 1.2.25 - February 18, 2008
+ libpng version 1.2.29 - May 8, 2008
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2008 Glenn Randers-Pehrson
For conditions of distribution and use, see copyright
notice in png.h.
- based on:
+ Based on:
+
+ libpng versions 0.97, January 1998, through 1.2.29 - May 8, 2008
+ Updated and distributed by Glenn Randers-Pehrson
+ Copyright (c) 1998-2008 Glenn Randers-Pehrson
libpng 1.0 beta 6 version 0.96 May 28, 1997
Updated and distributed by Andreas Dilger
@@ -457,12 +461,14 @@ a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2003 (E)) at
The W3C and ISO documents have identical technical content.
The PNG-1.2 specification is available at
-<http://www.libpng.org/pub/png/documents/>
+<http://www.libpng.org/pub/png/documents/>. It is technically equivalent
+to the PNG specification (second edition) but has some additional material.
The PNG-1.0 specification is available
as RFC 2083 <http://www.libpng.org/pub/png/documents/> and as a
-W3C Recommendation <http://www.w3.org/TR/REC.png.html>. Some
-additional chunks are described in the special-purpose public chunks
+W3C Recommendation <http://www.w3.org/TR/REC.png.html>.
+
+Some additional chunks are described in the special-purpose public chunks
documents at <http://www.libpng.org/pub/png/documents/>.
Other information
@@ -670,15 +676,19 @@ input stream. You must supply the function
png_unknown_chunkp chunk);
{
/* The unknown chunk structure contains your
- chunk data: */
+ chunk data, along with similar data for any other
+ unknown chunks: */
+
png_byte name[5];
png_byte *data;
png_size_t size;
+
/* Note that libpng has already taken care of
the CRC handling */
- /* put your code here. Return one of the
- following: */
+ /* put your code here. Search for your chunk in the
+ unknown chunk structure, process it, and return one
+ of the following: */
return (-n); /* chunk had an error */
return (0); /* did not recognize */
@@ -698,6 +708,11 @@ you can retrieve with
png_get_user_chunk_ptr(png_ptr);
+If you call the png_set_read_user_chunk_fn() function, then all unknown
+chunks will be saved when read, in case your callback function will need
+one or more of them. This behavior can be changed with the
+png_set_keep_unknown_chunks() function, described below.
+
At this point, you can set up a callback function that will be
called after each row has been read, which you can use to control
a progress meter or the like. It's demonstrated in pngtest.c.
@@ -742,13 +757,13 @@ If you need to retrieve the limits that are being applied, use
Now you get to set the way the library processes unknown chunks in the
input PNG stream. Both known and unknown chunks will be read. Normal
behavior is that known chunks will be parsed into information in
-various info_ptr members; unknown chunks will be discarded. To change
+various info_ptr members while unknown chunks will be discarded. To change
this, you can call:
png_set_keep_unknown_chunks(png_ptr, keep,
chunk_list, num_chunks);
- keep - 0: do not handle as unknown
- 1: do not keep
+ keep - 0: default unknown chunk handling
+ 1: ignore; do not keep
2: keep only if safe-to-copy
3: keep even if unsafe-to-copy
You can use these definitions:
@@ -771,6 +786,37 @@ instances of png_set_keep_unknown_chunks(), the final instance will
take precedence. The IHDR and IEND chunks should not be named in
chunk_list; if they are, libpng will process them normally anyway.
+Here is an example of the usage of png_set_keep_unknown_chunks(),
+where the private "vpAg" chunk will later be processed by a user chunk
+callback function:
+
+ png_byte vpAg[5]={118, 112, 65, 103, (png_byte) '\0'};
+
+ #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+ png_byte unused_chunks[]=
+ {
+ 104, 73, 83, 84, (png_byte) '\0', /* hIST */
+ 105, 84, 88, 116, (png_byte) '\0', /* iTXt */
+ 112, 67, 65, 76, (png_byte) '\0', /* pCAL */
+ 115, 67, 65, 76, (png_byte) '\0', /* sCAL */
+ 115, 80, 76, 84, (png_byte) '\0', /* sPLT */
+ 116, 73, 77, 69, (png_byte) '\0', /* tIME */
+ };
+ #endif
+
+ ...
+
+ #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+ /* ignore all unknown chunks: */
+ png_set_keep_unknown_chunks(read_ptr, 1, NULL, 0);
+ /* except for vpAg: */
+ png_set_keep_unknown_chunks(read_ptr, 2, vpAg, 1);
+ /* also ignore unused known chunks: */
+ png_set_keep_unknown_chunks(read_ptr, 1, unused_chunks,
+ (int)sizeof(unused_chunks)/5);
+ #endif
+
+
.SS The high-level read interface
At this point there are two ways to proceed; through the high-level
@@ -1214,6 +1260,7 @@ added. It expands the sample depth without changing tRNS to alpha.
At the same time, png_set_gray_1_2_4_to_8() was deprecated, and it
will be removed from a future version.
+
PNG can have files with 16 bits per channel. If you only can handle
8 bits per channel, this will strip the pixels down to 8 bit.
@@ -2153,6 +2200,11 @@ Some of the more important parts of the png_info are:
can also be
PNG_INTRAPIXEL_DIFFERENCING)
+If you call png_set_IHDR(), the call must appear before any of the
+other png_set_*() functions, which might require access to some of
+the IHDR settings. The remaining png_set_*() functions can be called
+in any order.
+
png_set_PLTE(png_ptr, info_ptr, palette,
num_palette);
palette - the palette for the file
@@ -2801,6 +2853,9 @@ Your malloc_fn() must return NULL in case of failure. The png_malloc()
function will normally call png_error() if it receives a NULL from the
system memory allocator or from your replacement malloc_fn().
+Your free_fn() will never be called with a NULL ptr, since libpng's
+png_free() checks for NULL before calling free_fn().
+
Input/Output in libpng is done through png_read() and png_write(),
which currently just call fread() and fwrite(). The FILE * is stored in
png_struct and is initialized via png_init_io(). If you wish to change
@@ -3206,13 +3261,13 @@ application:
.SH IX. Y2K Compliance in libpng
-February 18, 2008
+May 8, 2008
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.2.25 are Y2K compliant. It is my belief that earlier
+upward through 1.2.29 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that
@@ -3428,6 +3483,22 @@ the first widely used release:
1.2.24 13 10224 12.so.0.24[.0]
1.2.25beta01-06 13 10225 12.so.0.25[.0]
1.2.25rc01-02 13 10225 12.so.0.25[.0]
+ 1.0.31 10 10031 10.so.0.31[.0]
+ 1.2.25 13 10225 12.so.0.25[.0]
+ 1.2.26beta01-06 13 10226 12.so.0.26[.0]
+ 1.2.26rc01 13 10226 12.so.0.26[.0]
+ 1.2.26 13 10226 12.so.0.26[.0]
+ 1.0.32 10 10032 10.so.0.32[.0]
+ 1.2.27beta01-06 13 10227 12.so.0.27[.0]
+ 1.2.27rc01 13 10227 12.so.0.27[.0]
+ 1.0.33 10 10033 10.so.0.33[.0]
+ 1.2.27 13 10227 12.so.0.27[.0]
+ 1.0.34 10 10034 10.so.0.34[.0]
+ 1.2.28 13 10228 12.so.0.28[.0]
+ 1.2.29beta01-03 13 10229 12.so.0.29[.0]
+ 1.2.29rc01 13 10229 12.so.0.29[.0]
+ 1.0.35 10 10035 10.so.0.35[.0]
+ 1.2.29 13 10229 12.so.0.29[.0]
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
@@ -3463,7 +3534,7 @@ ftp://ftp.info-zip.org/pub/infozip/zlib
.I libpng
or at
.br
-ftp://ds.internic.net/rfc/rfc2083.txt
+ftp://ftp.rfc-editor.org:/in-notes/rfc2083.txt
.br
or (as a W3C Recommendation) at
.br
@@ -3483,7 +3554,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
-Libpng version 1.2.25 - February 18, 2008:
+Libpng version 1.2.29 - May 8, 2008:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@@ -3504,7 +3575,7 @@ included in the libpng distribution, the latter shall prevail.)
If you modify libpng you may insert additional notices immediately following
this sentence.
-libpng versions 1.2.6, August 15, 2004, through 1.2.25, February 18, 2008, are
+libpng versions 1.2.6, August 15, 2004, through 1.2.29, May 8, 2008, are
Copyright (c) 2004,2006-2008 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@@ -3603,7 +3674,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-February 18, 2008
+May 8, 2008
.\" end of man page
diff --git a/Build/source/libs/libpng/libpngpf.3 b/Build/source/libs/libpng/libpngpf.3
index a5b09b6e4eb..423964f9247 100644
--- a/Build/source/libs/libpng/libpngpf.3
+++ b/Build/source/libs/libpng/libpngpf.3
@@ -1,6 +1,6 @@
-.TH LIBPNGPF 3 "February 18, 2008"
+.TH LIBPNGPF 3 "May 8, 2008"
.SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.2.25
+libpng \- Portable Network Graphics (PNG) Reference Library 1.2.29
(private functions)
.SH SYNOPSIS
\fB#include <png.h>\fP
diff --git a/Build/source/libs/libpng/png.5 b/Build/source/libs/libpng/png.5
index 6b5aa3a03a5..832a6f4c546 100644
--- a/Build/source/libs/libpng/png.5
+++ b/Build/source/libs/libpng/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "February 18, 2008"
+.TH PNG 5 "May 8, 2008"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION
@@ -35,7 +35,7 @@ PNG 1.0 specification, October 1996:
RFC 2083
.IP
.br
-ftp://ds.internic.net/rfc/rfc2083.txt
+ftp://ftp.rfc-editor.org:/in-notes/rfc2083.txt
.br
or (as a W3C Recommendation) at
.br
diff --git a/Build/source/libs/libpng/png.c b/Build/source/libs/libpng/png.c
index cc31ae8d34c..63ae86e3c42 100644
--- a/Build/source/libs/libpng/png.c
+++ b/Build/source/libs/libpng/png.c
@@ -13,7 +13,7 @@
#include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_25 Your_png_h_is_not_version_1_2_25;
+typedef version_1_2_29 Your_png_h_is_not_version_1_2_29;
/* Version information for C files. This had better match the version
* string defined in png.h. */
@@ -693,7 +693,7 @@ png_charp PNGAPI
png_get_copyright(png_structp png_ptr)
{
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
- return ((png_charp) "\n libpng version 1.2.25 - February 18, 2008\n\
+ return ((png_charp) "\n libpng version 1.2.29 - May 8, 2008\n\
Copyright (c) 1998-2008 Glenn Randers-Pehrson\n\
Copyright (c) 1996-1997 Andreas Dilger\n\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
diff --git a/Build/source/libs/libpng/png.h b/Build/source/libs/libpng/png.h
index 6e538552cb5..2e194b7a3d9 100644
--- a/Build/source/libs/libpng/png.h
+++ b/Build/source/libs/libpng/png.h
@@ -1,7 +1,6 @@
-
/* png.h - header file for PNG reference library
*
- * libpng version 1.2.25 - February 18, 2008
+ * libpng version 1.2.29 - May 8, 2008
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -9,7 +8,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- * libpng versions 0.97, January 1998, through 1.2.25 - February 18, 2008: Glenn
+ * libpng versions 0.97, January 1998, through 1.2.29 - May 8, 2008: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -177,6 +176,22 @@
* 1.2.24 13 10224 12.so.0.24[.0]
* 1.2.25beta01-06 13 10225 12.so.0.25[.0]
* 1.2.25rc01-02 13 10225 12.so.0.25[.0]
+ * 1.0.31 10 10031 10.so.0.31[.0]
+ * 1.2.25 13 10225 12.so.0.25[.0]
+ * 1.2.26beta01-06 13 10226 12.so.0.26[.0]
+ * 1.2.26rc01 13 10226 12.so.0.26[.0]
+ * 1.2.26 13 10226 12.so.0.26[.0]
+ * 1.0.32 10 10032 10.so.0.32[.0]
+ * 1.2.27beta01-06 13 10227 12.so.0.27[.0]
+ * 1.2.27rc01 13 10227 12.so.0.27[.0]
+ * 1.0.33 10 10033 10.so.0.33[.0]
+ * 1.2.27 13 10227 12.so.0.27[.0]
+ * 1.0.34 10 10034 10.so.0.34[.0]
+ * 1.2.28 13 10228 12.so.0.28[.0]
+ * 1.2.29beta01-03 13 10229 12.so.0.29[.0]
+ * 1.2.29rc01 13 10229 12.so.0.29[.0]
+ * 1.0.35 10 10035 10.so.0.35[.0]
+ * 1.2.29 13 10229 12.so.0.29[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -186,7 +201,7 @@
* to the source version x.y.z (leading zeros in y and z). Beta versions
* were given the previous public release number plus a letter, until
* version 1.0.6j; from then on they were given the upcoming public
- * release number plus "betaNN" or "rcN".
+ * release number plus "betaNN" or "rcNN".
*
* Binary incompatibility exists only when applications make direct access
* to the info_ptr or png_ptr members through png.h, and the compiled
@@ -206,7 +221,7 @@
* If you modify libpng you may insert additional notices immediately following
* this sentence.
*
- * libpng versions 1.2.6, August 15, 2004, through 1.2.25, February 18, 2008, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.2.29, May 8, 2008, are
* Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
@@ -318,13 +333,13 @@
* Y2K compliance in libpng:
* =========================
*
- * February 18, 2008
+ * May 8, 2008
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
- * upward through 1.2.25 are Y2K compliant. It is my belief that earlier
+ * upward through 1.2.29 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant.
*
* Libpng only has three year fields. One is a 2-byte unsigned integer
@@ -380,9 +395,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.2.25"
+#define PNG_LIBPNG_VER_STRING "1.2.29"
#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.2.25 - February 18, 2008\n"
+ " libpng version 1.2.29 - May 8, 2008\n"
#define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM 13
@@ -390,7 +405,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 2
-#define PNG_LIBPNG_VER_RELEASE 25
+#define PNG_LIBPNG_VER_RELEASE 29
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
@@ -418,7 +433,7 @@
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
* version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */
-#define PNG_LIBPNG_VER 10225 /* 1.2.25 */
+#define PNG_LIBPNG_VER 10229 /* 1.2.29 */
#ifndef PNG_VERSION_INFO_ONLY
/* include the compression library's header */
@@ -1426,13 +1441,16 @@ struct png_struct_def
/* storage for unknown chunk that the library doesn't recognize. */
png_unknown_chunk unknown_chunk;
#endif
+
+/* New members added in libpng-1.2.26 */
+ png_uint_32 old_big_row_buf_size, old_prev_row_size;
};
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
-typedef png_structp version_1_2_25;
+typedef png_structp version_1_2_29;
typedef png_struct FAR * FAR * png_structpp;
diff --git a/Build/source/libs/libpng/pngconf.h b/Build/source/libs/libpng/pngconf.h
index b8e6844c1c8..d1e29957e0b 100644
--- a/Build/source/libs/libpng/pngconf.h
+++ b/Build/source/libs/libpng/pngconf.h
@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.2.25 - February 18, 2008
+ * libpng version 1.2.29 - May 8, 2008
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/Build/source/libs/libpng/pnggccrd.c b/Build/source/libs/libpng/pnggccrd.c
index a7248d6ca64..e61523e77a2 100644
--- a/Build/source/libs/libpng/pnggccrd.c
+++ b/Build/source/libs/libpng/pnggccrd.c
@@ -2,8 +2,10 @@
/* This code snippet is for use by configure's compilation test. */
-#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
+#if (!defined _MSC_VER) && \
+ defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
defined(PNG_MMX_CODE_SUPPORTED)
+
int PNGAPI png_dummy_mmx_support(void);
static int _mmx_supported = 2; // 0: no MMX; 1: MMX supported; 2: not tested
diff --git a/Build/source/libs/libpng/pngmem.c b/Build/source/libs/libpng/pngmem.c
index 248060f3817..13cc60c0361 100644
--- a/Build/source/libs/libpng/pngmem.c
+++ b/Build/source/libs/libpng/pngmem.c
@@ -1,9 +1,9 @@
/* pngmem.c - stub functions for memory allocation
*
- * Last changed in libpng 1.2.13 November 13, 2006
+ * Last changed in libpng 1.2.27 [April 29, 2008]
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2006 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -293,7 +293,7 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
{
#endif /* PNG_USER_MEM_SUPPORTED */
- if(png_ptr == NULL) return;
+ if(png_ptr == NULL || ptr == NULL) return;
if (png_ptr->offset_table != NULL)
{
@@ -456,7 +456,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
if (size > (png_uint_32)65536L)
{
#ifndef PNG_USER_MEM_SUPPORTED
- if(png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+ if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Cannot Allocate > 64K");
else
#endif
diff --git a/Build/source/libs/libpng/pngpread.c b/Build/source/libs/libpng/pngpread.c
index a02cdfcb238..aa7151c4b39 100644
--- a/Build/source/libs/libpng/pngpread.c
+++ b/Build/source/libs/libpng/pngpread.c
@@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode
*
- * Last changed in libpng 1.2.25 [February 18, 2008]
+ * Last changed in libpng 1.2.27 [April 29, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -224,6 +224,8 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
{
+ if (png_ptr->push_length != 13)
+ png_error(png_ptr, "Invalid IHDR length");
png_push_save_buffer(png_ptr);
return;
}
@@ -1500,9 +1502,14 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
png_sizeof(png_ptr->unknown_chunk.name));
png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name)-1]='\0';
- png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length);
png_ptr->unknown_chunk.size = (png_size_t)length;
- png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
+ if (length == 0)
+ png_ptr->unknown_chunk.data = NULL;
+ else
+ {
+ png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length);
+ png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
+ }
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
if(png_ptr->read_user_chunk_fn != NULL)
{
diff --git a/Build/source/libs/libpng/pngrtran.c b/Build/source/libs/libpng/pngrtran.c
index c020b51b3d2..873b22cf34d 100644
--- a/Build/source/libs/libpng/pngrtran.c
+++ b/Build/source/libs/libpng/pngrtran.c
@@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
- * Last changed in libpng 1.2.25 [February 18, 2008]
+ * Last changed in libpng 1.2.27 [April 29, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -548,9 +548,7 @@ png_set_expand(png_structp png_ptr)
png_debug(1, "in png_set_expand\n");
if(png_ptr == NULL) return;
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
-#ifdef PNG_WARN_UNINITIALIZED_ROW
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
-#endif
}
/* GRR 19990627: the following three functions currently are identical
@@ -577,9 +575,7 @@ png_set_palette_to_rgb(png_structp png_ptr)
png_debug(1, "in png_set_palette_to_rgb\n");
if(png_ptr == NULL) return;
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
-#ifdef PNG_WARN_UNINITIALIZED_ROW
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
-#endif
}
#if !defined(PNG_1_0_X)
@@ -590,9 +586,7 @@ png_set_expand_gray_1_2_4_to_8(png_structp png_ptr)
png_debug(1, "in png_set_expand_gray_1_2_4_to_8\n");
if(png_ptr == NULL) return;
png_ptr->transformations |= PNG_EXPAND;
-#ifdef PNG_WARN_UNINITIALIZED_ROW
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
-#endif
}
#endif
@@ -615,9 +609,7 @@ png_set_tRNS_to_alpha(png_structp png_ptr)
{
png_debug(1, "in png_set_tRNS_to_alpha\n");
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
-#ifdef PNG_WARN_UNINITIALIZED_ROW
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
-#endif
}
#endif /* defined(PNG_READ_EXPAND_SUPPORTED) */
@@ -627,9 +619,7 @@ png_set_gray_to_rgb(png_structp png_ptr)
{
png_debug(1, "in png_set_gray_to_rgb\n");
png_ptr->transformations |= PNG_GRAY_TO_RGB;
-#ifdef PNG_WARN_UNINITIALIZED_ROW
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
-#endif
}
#endif
@@ -967,7 +957,7 @@ png_init_read_transformations(png_structp png_ptr)
/* Prevent the transformations being done again, and make sure
* that the now spurious alpha channel is stripped - the code
* has just reduced background composition and gamma correction
- * to a simply alpha channel strip.
+ * to a simple alpha channel strip.
*/
png_ptr->transformations &= ~PNG_BACKGROUND;
png_ptr->transformations &= ~PNG_GAMMA;
@@ -1138,7 +1128,8 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
{
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{
- if (png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND_tRNS))
+ if (png_ptr->num_trans &&
+ (png_ptr->transformations & PNG_EXPAND_tRNS))
info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
else
info_ptr->color_type = PNG_COLOR_TYPE_RGB;
@@ -1151,8 +1142,10 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr->transformations & PNG_EXPAND_tRNS)
info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
+#if 0 /* Removed from libpng-1.2.27 */
else
info_ptr->color_type |= PNG_COLOR_MASK_COLOR;
+#endif
}
if (info_ptr->bit_depth < 8)
info_ptr->bit_depth = 8;
diff --git a/Build/source/libs/libpng/pngrutil.c b/Build/source/libs/libpng/pngrutil.c
index 990e69802b1..531cb0570eb 100644
--- a/Build/source/libs/libpng/pngrutil.c
+++ b/Build/source/libs/libpng/pngrutil.c
@@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
- * Last changed in libpng 1.2.25 [February 18, 2008]
+ * Last changed in libpng 1.2.27 [April 29, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -1241,15 +1241,9 @@ void /* PRIVATE */
png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_byte readbuf[PNG_MAX_PALETTE_LENGTH];
- int bit_mask;
png_debug(1, "in png_handle_tRNS\n");
- /* For non-indexed color, mask off any bits in the tRNS value that
- * exceed the bit depth. Some creators were writing extra bits there.
- * This is not needed for indexed color. */
- bit_mask = (1 << png_ptr->bit_depth) - 1;
-
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before tRNS");
else if (png_ptr->mode & PNG_HAVE_IDAT)
@@ -1278,7 +1272,7 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_crc_read(png_ptr, buf, 2);
png_ptr->num_trans = 1;
- png_ptr->trans_values.gray = png_get_uint_16(buf) & bit_mask;
+ png_ptr->trans_values.gray = png_get_uint_16(buf);
}
else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
{
@@ -1292,9 +1286,9 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
png_crc_read(png_ptr, buf, (png_size_t)length);
png_ptr->num_trans = 1;
- png_ptr->trans_values.red = png_get_uint_16(buf) & bit_mask;
- png_ptr->trans_values.green = png_get_uint_16(buf + 2) & bit_mask;
- png_ptr->trans_values.blue = png_get_uint_16(buf + 4) & bit_mask;
+ png_ptr->trans_values.red = png_get_uint_16(buf);
+ png_ptr->trans_values.green = png_get_uint_16(buf + 2);
+ png_ptr->trans_values.blue = png_get_uint_16(buf + 4);
}
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{
@@ -2227,9 +2221,14 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
(png_charp)png_ptr->chunk_name,
png_sizeof(png_ptr->unknown_chunk.name));
png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name)-1] = '\0';
- png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length);
png_ptr->unknown_chunk.size = (png_size_t)length;
- png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
+ if (length == 0)
+ png_ptr->unknown_chunk.data = NULL;
+ else
+ {
+ png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length);
+ png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
+ }
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
if(png_ptr->read_user_chunk_fn != NULL)
{
@@ -2251,7 +2250,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
else
#endif
- png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
+ png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
png_free(png_ptr, png_ptr->unknown_chunk.data);
png_ptr->unknown_chunk.data = NULL;
}
@@ -2851,6 +2850,7 @@ void /* PRIVATE */
png_read_finish_row(png_structp png_ptr)
{
#ifdef PNG_USE_LOCAL_ARRAYS
+#ifdef PNG_READ_INTERLACING_SUPPORTED
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* start of interlace block */
@@ -2864,6 +2864,7 @@ png_read_finish_row(png_structp png_ptr)
/* offset to next interlace block in the y direction */
PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+#endif /* PNG_READ_INTERLACING_SUPPORTED */
#endif
png_debug(1, "in png_read_finish_row\n");
@@ -2871,6 +2872,7 @@ png_read_finish_row(png_structp png_ptr)
if (png_ptr->row_number < png_ptr->num_rows)
return;
+#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced)
{
png_ptr->row_number = 0;
@@ -2905,6 +2907,7 @@ png_read_finish_row(png_structp png_ptr)
if (png_ptr->pass < 7)
return;
}
+#endif /* PNG_READ_INTERLACING_SUPPORTED */
if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
{
@@ -2979,6 +2982,7 @@ void /* PRIVATE */
png_read_start_row(png_structp png_ptr)
{
#ifdef PNG_USE_LOCAL_ARRAYS
+#ifdef PNG_READ_INTERLACING_SUPPORTED
/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* start of interlace block */
@@ -2993,6 +2997,7 @@ png_read_start_row(png_structp png_ptr)
/* offset to next interlace block in the y direction */
PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif
+#endif
int max_pixel_depth;
png_uint_32 row_bytes;
@@ -3000,6 +3005,7 @@ png_read_start_row(png_structp png_ptr)
png_debug(1, "in png_read_start_row\n");
png_ptr->zstream.avail_in = 0;
png_init_read_transformations(png_ptr);
+#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced)
{
if (!(png_ptr->transformations & PNG_INTERLACE))
@@ -3020,6 +3026,7 @@ png_read_start_row(png_structp png_ptr)
png_error(png_ptr, "Rowbytes overflow in png_read_start_row");
}
else
+#endif /* PNG_READ_INTERLACING_SUPPORTED */
{
png_ptr->num_rows = png_ptr->height;
png_ptr->iwidth = png_ptr->width;
@@ -3138,8 +3145,14 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
if (row_bytes > (png_uint_32)65536L)
png_error(png_ptr, "This image requires a row greater than 64KB");
#endif
- png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes+64);
- png_ptr->row_buf = png_ptr->big_row_buf+32;
+
+ if(row_bytes + 64 > png_ptr->old_big_row_buf_size)
+ {
+ png_free(png_ptr,png_ptr->big_row_buf);
+ png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes+64);
+ png_ptr->row_buf = png_ptr->big_row_buf+32;
+ png_ptr->old_big_row_buf_size = row_bytes+64;
+ }
#ifdef PNG_MAX_MALLOC_64K
if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L)
@@ -3147,8 +3160,14 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
#endif
if ((png_uint_32)png_ptr->rowbytes > (png_uint_32)(PNG_SIZE_MAX - 1))
png_error(png_ptr, "Row has too many bytes to allocate in memory.");
- png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)(
- png_ptr->rowbytes + 1));
+
+ if(png_ptr->rowbytes+1 > png_ptr->old_prev_row_size)
+ {
+ png_free(png_ptr,png_ptr->prev_row);
+ png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)(
+ png_ptr->rowbytes + 1));
+ png_ptr->old_prev_row_size = png_ptr->rowbytes+1;
+ }
png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
diff --git a/Build/source/libs/libpng/pngset.c b/Build/source/libs/libpng/pngset.c
index 9301dd3274a..8b25ca504c5 100644
--- a/Build/source/libs/libpng/pngset.c
+++ b/Build/source/libs/libpng/pngset.c
@@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
- * Last changed in libpng 1.2.25 [February 18, 2008]
+ * Last changed in libpng 1.2.27 [April 29, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -914,6 +914,8 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
if (png_ptr == NULL || info_ptr == NULL)
return;
+ png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
+
if (trans != NULL)
{
/*
@@ -921,30 +923,41 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
* we do it for backward compatibility with the way the png_handle_tRNS
* function used to do the allocation.
*/
-#ifdef PNG_FREE_ME_SUPPORTED
- png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
-#endif
+
/* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
png_ptr->trans = info_ptr->trans = (png_bytep)png_malloc(png_ptr,
(png_uint_32)PNG_MAX_PALETTE_LENGTH);
- if (num_trans <= PNG_MAX_PALETTE_LENGTH)
+ if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
png_memcpy(info_ptr->trans, trans, (png_size_t)num_trans);
-#ifdef PNG_FREE_ME_SUPPORTED
- info_ptr->free_me |= PNG_FREE_TRNS;
-#else
- png_ptr->flags |= PNG_FLAG_FREE_TRNS;
-#endif
}
if (trans_values != NULL)
{
+ int sample_max = (1 << info_ptr->bit_depth);
+ if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
+ (int)trans_values->gray > sample_max) ||
+ (info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
+ ((int)trans_values->red > sample_max ||
+ (int)trans_values->green > sample_max ||
+ (int)trans_values->blue > sample_max)))
+ png_warning(png_ptr,
+ "tRNS chunk has out-of-range samples for bit_depth");
png_memcpy(&(info_ptr->trans_values), trans_values,
png_sizeof(png_color_16));
if (num_trans == 0)
num_trans = 1;
}
+
info_ptr->num_trans = (png_uint_16)num_trans;
- info_ptr->valid |= PNG_INFO_tRNS;
+ if (num_trans != 0)
+ {
+ info_ptr->valid |= PNG_INFO_tRNS;
+#ifdef PNG_FREE_ME_SUPPORTED
+ info_ptr->free_me |= PNG_FREE_TRNS;
+#else
+ png_ptr->flags |= PNG_FLAG_FREE_TRNS;
+#endif
+ }
}
#endif
@@ -1040,28 +1053,31 @@ png_set_unknown_chunks(png_structp png_ptr,
for (i = 0; i < num_unknowns; i++)
{
- png_unknown_chunkp to = np + info_ptr->unknown_chunks_num + i;
- png_unknown_chunkp from = unknowns + i;
-
- png_memcpy((png_charp)to->name,
- (png_charp)from->name,
- png_sizeof(from->name));
- to->name[png_sizeof(to->name)-1] = '\0';
-
- to->data = (png_bytep)png_malloc_warn(png_ptr, from->size);
- if (to->data == NULL)
- {
- png_warning(png_ptr,
+ png_unknown_chunkp to = np + info_ptr->unknown_chunks_num + i;
+ png_unknown_chunkp from = unknowns + i;
+
+ png_memcpy((png_charp)to->name,
+ (png_charp)from->name,
+ png_sizeof(from->name));
+ to->name[png_sizeof(to->name)-1] = '\0';
+ to->size = from->size;
+ /* note our location in the read or write sequence */
+ to->location = (png_byte)(png_ptr->mode & 0xff);
+
+ if (from->size == 0)
+ to->data=NULL;
+ else
+ {
+ to->data = (png_bytep)png_malloc_warn(png_ptr, from->size);
+ if (to->data == NULL)
+ {
+ png_warning(png_ptr,
"Out of memory while processing unknown chunk.");
- }
- else
- {
- png_memcpy(to->data, from->data, from->size);
- to->size = from->size;
-
- /* note our location in the read or write sequence */
- to->location = (png_byte)(png_ptr->mode & 0xff);
- }
+ to->size=0;
+ }
+ else
+ png_memcpy(to->data, from->data, from->size);
+ }
}
info_ptr->unknown_chunks = np;
@@ -1193,8 +1209,7 @@ png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size)
{
if (png_ptr == NULL)
return;
- if(png_ptr->zbuf)
- png_free(png_ptr, png_ptr->zbuf);
+ png_free(png_ptr, png_ptr->zbuf);
png_ptr->zbuf_size = (png_size_t)size;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size);
png_ptr->zstream.next_out = png_ptr->zbuf;
diff --git a/Build/source/libs/libpng/pngtest.c b/Build/source/libs/libpng/pngtest.c
index 51073220e2d..60980c27585 100644
--- a/Build/source/libs/libpng/pngtest.c
+++ b/Build/source/libs/libpng/pngtest.c
@@ -1,9 +1,9 @@
/* pngtest.c - a simple test program to test libpng
*
- * Last changed in libpng 1.2.23 - [November 6, 2007]
+ * Last changed in libpng 1.2.27 - [April 29, 2008]
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2007 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -689,8 +689,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
{
fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname);
- if (row_buf)
- png_free(read_ptr, row_buf);
+ png_free(read_ptr, row_buf);
png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
#ifdef PNG_WRITE_SUPPORTED
png_destroy_info_struct(write_ptr, &write_end_info_ptr);
@@ -1024,8 +1023,16 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_tRNS(read_ptr, read_info_ptr, &trans, &num_trans,
&trans_values))
{
- png_set_tRNS(write_ptr, write_info_ptr, trans, num_trans,
- trans_values);
+ int sample_max = (1 << read_info_ptr->bit_depth);
+ /* libpng doesn't reject a tRNS chunk with out-of-range samples */
+ if (!((read_info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
+ (int)trans_values->gray > sample_max) ||
+ (read_info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
+ ((int)trans_values->red > sample_max ||
+ (int)trans_values->green > sample_max ||
+ (int)trans_values->blue > sample_max))))
+ png_set_tRNS(write_ptr, write_info_ptr, trans, num_trans,
+ trans_values);
}
}
#endif
@@ -1553,4 +1560,4 @@ main(int argc, char *argv[])
}
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_25 your_png_h_is_not_version_1_2_25;
+typedef version_1_2_29 your_png_h_is_not_version_1_2_29;
diff --git a/Build/source/libs/libpng/pngwrite.c b/Build/source/libs/libpng/pngwrite.c
index 8b01025f540..7d02ad7ddfa 100644
--- a/Build/source/libs/libpng/pngwrite.c
+++ b/Build/source/libs/libpng/pngwrite.c
@@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
- * Last changed in libpng 1.2.25 [February 18, 2008]
+ * Last changed in libpng 1.2.27 [April 29, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -112,6 +112,8 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
{
+ if (up->size == 0)
+ png_warning(png_ptr, "Writing zero-length unknown chunk");
png_write_chunk(png_ptr, up->name, up->data, up->size);
}
}
diff --git a/Build/source/libs/libpng/pngwutil.c b/Build/source/libs/libpng/pngwutil.c
index fef38aef9dd..0774080b4d1 100644
--- a/Build/source/libs/libpng/pngwutil.c
+++ b/Build/source/libs/libpng/pngwutil.c
@@ -1,9 +1,9 @@
/* pngwutil.c - utilities to write a PNG file
*
- * Last changed in libpng 1.2.20 Septhember 3, 2007
+ * Last changed in libpng 1.2.27 [April 29, 2008]
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2007 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/
@@ -380,6 +380,8 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
#ifdef PNG_USE_LOCAL_ARRAYS
PNG_IHDR;
#endif
+ int ret;
+
png_byte buf[13]; /* buffer to store the IHDR info */
png_debug(1, "in png_write_IHDR\n");
@@ -523,10 +525,19 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
png_ptr->zlib_window_bits = 15;
if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_METHOD))
png_ptr->zlib_method = 8;
- if (deflateInit2(&png_ptr->zstream, png_ptr->zlib_level,
- png_ptr->zlib_method, png_ptr->zlib_window_bits,
- png_ptr->zlib_mem_level, png_ptr->zlib_strategy) != Z_OK)
- png_error(png_ptr, "zlib failed to initialize compressor");
+ ret = deflateInit2(&png_ptr->zstream, png_ptr->zlib_level,
+ png_ptr->zlib_method, png_ptr->zlib_window_bits,
+ png_ptr->zlib_mem_level, png_ptr->zlib_strategy);
+ if (ret != Z_OK)
+ {
+ if (ret == Z_VERSION_ERROR) png_error(png_ptr,
+ "zlib failed to initialize compressor -- version error");
+ if (ret == Z_STREAM_ERROR) png_error(png_ptr,
+ "zlib failed to initialize compressor -- stream error");
+ if (ret == Z_MEM_ERROR) png_error(png_ptr,
+ "zlib failed to initialize compressor -- mem error");
+ png_error(png_ptr, "zlib failed to initialize compressor");
+ }
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
/* libpng is not interested in zstream.data_type */
@@ -1505,8 +1516,7 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
png_write_chunk_end(png_ptr);
png_free(png_ptr, new_key);
- if (new_lang)
- png_free(png_ptr, new_lang);
+ png_free(png_ptr, new_lang);
}
#endif