Updated the bundled libpng to v1.2.33.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6592 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser
2008-12-17 18:57:18 +00:00
parent 63b8523126
commit 3db04d80a1
29 changed files with 2038 additions and 596 deletions
+1
View File
@@ -1,5 +1,6 @@
CHANGES IN FLTK 1.3.0 CHANGES IN FLTK 1.3.0
- Updated the bundled libpng to v1.2.33.
- Fixed callback would not be called when shortcut was used with - Fixed callback would not be called when shortcut was used with
radio and toggle buttons in default FL_RELEASE mode. radio and toggle buttons in default FL_RELEASE mode.
- Fixed a problem with TrackMouseEvent() (Windows only) that would - Fixed a problem with TrackMouseEvent() (Windows only) that would
+24 -36
View File
@@ -1,5 +1,5 @@
Libpng 1.2.25 - February 18, 2008 Libpng 1.2.33 - October 31, 2008
This is a public release of libpng, intended for use in production codes. This is a public release of libpng, intended for use in production codes.
@@ -8,59 +8,47 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a Source files with LF line endings (for Unix/Linux) and with a
"configure" script "configure" script
libpng-1.2.25.tar.gz libpng-1.2.33.tar.gz
libpng-1.2.25.tar.lzma libpng-1.2.33.tar.lzma
(Get the lzma codec from <http://tukaani.org/lzma>). (Get the lzma codec from <http://tukaani.org/lzma>).
libpng-1.2.25.tar.bz2 libpng-1.2.33.tar.bz2
Source files with LF line endings (for Unix/Linux) without the Source files with LF line endings (for Unix/Linux) without the
"configure" script "configure" script
libpng-1.2.25-no-config.tar.gz libpng-1.2.33-no-config.tar.gz
libpng-1.2.25-no-config.tar.lzma libpng-1.2.33-no-config.tar.lzma
libpng-1.2.25-no-config.tar.bz2 libpng-1.2.33-no-config.tar.bz2
Source files with CRLF line endings (for Windows), without the Source files with CRLF line endings (for Windows), without the
"configure" script "configure" script
lpng1225.zip lpng1233.zip
lpng1225.7z lpng1233.7z
lpng1225.tar.bz2 lpng1233.tar.bz2
Project files Project files
libpng-1.2.25-project-netware.zip libpng-1.2.33-project-netware.zip
libpng-1.2.25-project-wince.zip libpng-1.2.33-project-wince.zip
Other information: Other information:
libpng-1.2.25-README.txt libpng-1.2.33-README.txt
libpng-1.2.25-KNOWNBUGS.txt libpng-1.2.33-KNOWNBUGS.txt
libpng-1.2.25-LICENSE.txt libpng-1.2.33-LICENSE.txt
libpng-1.2.25-Y2K-compliance.txt libpng-1.2.33-Y2K-compliance.txt
libpng-1.2.25-1.2.24-diff.txt libpng-1.2.33-[previous version]-diff.txt
Changes since the last public release (1.2.24): Changes since the last public release (1.2.32):
version 1.2.25 [February 18, 2008] version 1.2.33 [October 31, 2008]
Fixed bug with unknown chunk handling, introduced in version 1.2.17 Revised makefile.darwin to fix shared library numbering.
Prevent gamma from being applied twice. Change png_set_gray_1_2_4_to_8() to png_set_expand_gray_1_2_4_to_8()
Fixed some continue-after-malloc-failure errors in pngset.c (David Hill) in example.c (debian bug report)
Check for info_ptr == NULL in png_read_info() and png_process_data(). Changed remaining "key" to "png_ptr->chunkdata" in png_handle_tEXt()
Check for possible use of NULL user_png_ver[] in png_create_read_struct(). to avoid memory leak after memory failure while reading tEXt chunk.`
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)
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit
+186 -1
View File
@@ -2048,7 +2048,7 @@ version 1.2.25beta03 [January 22, 2008]
Change "if (swidth == NULL)" to "if (sheight == NULL)" in png_handle_sCAL Change "if (swidth == NULL)" to "if (sheight == NULL)" in png_handle_sCAL
(bug introduced in libpng-1.2.4/1.0.13). (bug introduced in libpng-1.2.4/1.0.13).
Return from png_destroy_read_struct() if png_ptr_ptr is NULL. 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] version 1.2.25beta04 [January 26, 2008]
Work around Coverity bug report by slightly refactoring Work around Coverity bug report by slightly refactoring
@@ -2076,6 +2076,191 @@ version 1.2.25rc02 [February 10, 2008]
version 1.2.25 and 1.0.31 [February 18, 2008] version 1.2.25 and 1.0.31 [February 18, 2008]
No changes. 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
documentation.
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 MAINTAINERCLEANFILES 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.
version 1.0.37 [May 9, 2008]
Updated Makefile.in and configure (omitted version 1.0.36).
version 1.2.30beta01 [May 29, 2008]
Updated libpng.pc-configure.in and libpng-config.in per debian bug reports.
version 1.2.30beta02 [June 25, 2008]
Restored png_flush(png_ptr) at the end of png_write_end(), that was
removed from libpng-1.0.9beta03.
version 1.2.30beta03 [July 6, 2008]
Merged some cosmetic whitespace changes from libpng-1.4.0beta19.
Inline call of png_get_uint_32() in png_get_uint_31(), as in 1.4.0beta19.
Added demo of decoding vpAg and sTER chunks to pngtest.c, from 1.4.0beta19.
Changed PNGMAJ from 0 to 12 in makefile.darwin, which does not like 0.
Added new private function png_read_chunk_header() from 1.4.0beta19.
Merge reading of chunk length and chunk type into a single 8-byte read.
Merge writing of chunk length and chunk type into a single 8-byte write.
version 1.2.30beta04 [July 10, 2008]
Merged more cosmetic whitespace changes from libpng-1.4.0beta19.
version 1.0.38rc01, 1.2.30rc01 [October 31, 2008]
No changes.
version 1.0.38rc02, 1.2.30rc02 [July 21, 2008]
Moved local array "chunkdata" from pngrutil.c to the png_struct, so
it will be freed by png_read_destroy() in case of a read error (Kurt
Christensen).
version 1.0.38rc03, 1.2.30rc03 [July 21, 2008]
Changed "purpose" and "buffer" to png_ptr->chunkdata to avoid memory leaking.
version 1.0.38rc04, 1.2.30rc04 [July 22, 2008]
Changed "chunkdata = NULL" to "png_ptr->chunkdata = NULL" several places in
png_decompress_chunk().
version 1.0.38rc05, 1.2.30rc05 [July 25, 2008]
Changed all remaining "chunkdata" to "png_ptr->chunkdata" in
png_decompress_chunk() and remove chunkdata from parameter list.
Put a call to png_check_chunk_name() in png_read_chunk_header().
Revised png_check_chunk_name() to reject a name with a lowercase 3rd byte.
Removed two calls to png_check_chunk_name() occuring later in the process.
version 1.0.38rc06, 1.2.30rc06 [July 29, 2008]
Added a call to png_check_chunk_name() in pngpread.c
Reverted png_check_chunk_name() to accept a name with a lowercase 3rd byte.
version 1.0.38r07, 1.2.30r07 [August 2, 2008]
Changed "-Wall" to "-W -Wall" in the CFLAGS in all makefiles (Cosmin Truta)
Declared png_ptr "volatile" in pngread.c and pngwrite.c to avoid warnings.
Added code in pngset.c to quiet compiler warnings.
Updated contrib/visupng/cexcept.h to version 2.0.1
Relocated a misplaced "#endif /* PNG_NO_WRITE_FILTER */" in pngwutil.c
version 1.0.38r08, 1.2.30r08 [August 2, 2008]
Enclose "volatile" declarations in #ifdef PNG_SETJMP_SUPPORTED (Cosmin).
version 1.0.38, 1.2.30 [August 14, 2008]
No changes.
version 1.2.31rc01 [August 19, 2008]
Removed extra crc check at the end of png_handle_cHRM(). Bug introduced
in libpng-1.2.30beta03 (Heiko Nitzsche).
version 1.2.31rc02 [August 19, 2008]
Added PNG_WRITE_FLUSH_SUPPORTED block around new png_flush() call.
version 1.2.31rc03 [August 19, 2008]
Added PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED block, off by default, around
new png_flush().
version 1.0.39, 1.2.31 [August 21, 2008]
No changes.
version 1.2.32beta01 [September 6, 2008]
Shortened tIME_string to 29 bytes in pngtest.c (bug introduced in
libpng-1.2.22).
Fixed off-by-one error introduced in png_push_read_zTXt() function in
libpng-1.2.30beta04/pngpread.c (Harald van Dijk)
These bugs have been given the vulnerability id CVE-2008-3964.
version 1.0.40, 1.2.32 [September 18, 2008]
No changes.
version 1.2.33beta01 [October 6, 2008]
Revised makefile.darwin to fix shared library numbering.
Change png_set_gray_1_2_4_to_8() to png_set_expand_gray_1_2_4_to_8()
in example.c (debian bug report)
version 1.2.33rc01 [October 15, 2008]
No changes.
version 1.0.41rc01, version 1.2.33rc02 [October 31, 2008]
Changed remaining "key" to "png_ptr->chunkdata" in png_handle_tEXt()
to avoid memory leak after memory failure while reading tEXt chunk.`
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement
+8 -8
View File
@@ -1,5 +1,5 @@
Installing libpng version 1.2.25 - February 18, 2008 Installing libpng version 1.2.33 - October 31, 2008
On Unix/Linux and similar systems, you can simply type 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. correspond to the version of zlib that's installed.
You can rename the directories that you downloaded (they 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.33" or "lpng109" and "zlib-1.2.1"
or "zlib121") so that you have directories called "zlib" and "libpng". or "zlib121") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this: Your directory structure should look like this:
@@ -101,9 +101,9 @@ include
CMakeLists.txt => "cmake" script CMakeLists.txt => "cmake" script
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning, makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng12.so.0.1.2.25) gcc, creates libpng12.so.0.1.2.33)
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.25) (gcc, creates libpng12.so.0.1.2.33)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from ansi2knr (Requires ansi2knr.c from
@@ -125,14 +125,14 @@ include
makefile.openbsd => OpenBSD makefile makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, makefile.sggcc => Silicon Graphics (gcc,
creates libpng12.so.0.1.2.25) creates libpng12.so.0.1.2.33)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc, makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng12.so.0.1.2.25) creates libpng12.so.0.1.2.33)
makefile.solaris-x86 => Solaris/intelMMX 2.X makefile (gcc, makefile.solaris-x86 => Solaris/intelMMX 2.X makefile (gcc,
creates libpng12.so.0.1.2.25) creates libpng12.so.0.1.2.33)
makefile.so9 => Solaris 9 makefile (gcc, makefile.so9 => Solaris 9 makefile (gcc,
creates libpng12.so.0.1.2.25) creates libpng12.so.0.1.2.33)
makefile.32sunu => Sun Ultra 32-bit makefile makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
+1 -1
View File
@@ -1,5 +1,5 @@
Known bugs in libpng version 1.2.25 Known bugs in libpng version 1.2.33
1. February 23, 2006: The custom makefiles don't build libpng with -lz. 1. February 23, 2006: The custom makefiles don't build libpng with -lz.
+2 -2
View File
@@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
If you modify libpng you may insert additional notices immediately following If you modify libpng you may insert additional notices immediately following
this sentence. 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.33, October 31, 2008, are
Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors 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 Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
February 18, 2008 October 31, 2008
+15 -12
View File
@@ -1,12 +1,15 @@
README for libpng version 1.2.25 - February 18, 2008 (shared library 12.0) README for libpng version 1.2.33 - October 31, 2008 (shared library 12.0)
See the note about version numbers near the top of png.h See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng. See INSTALL for instructions on how to install libpng.
Libpng comes in several distribution formats. Get libpng-*.tar.gz, Libpng comes in several distribution formats. Get libpng-*.tar.gz,
libpng-*.tar.lzma, or libpng-*.tar.bz2 if you want UNIX-style line 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. line endings. You can get UNIX-style line endings from the *.zip file
by using "unzip -a" but there seems to be no simple way to recover
UNIX-style line endings from the *.7z file. The *.tar.lzma file is
recommended for *NIX users instead.
Version 0.89 was the first official release of libpng. Don't let the Version 0.89 was the first official release of libpng. Don't let the
fact that it's the first release fool you. The libpng library has been in fact that it's the first release fool you. The libpng library has been in
@@ -55,7 +58,7 @@ to set different actions based on whether the CRC error occurred in a
critical or an ancillary chunk. critical or an ancillary chunk.
The changes made to the library, and bugs fixed are based on discussions The changes made to the library, and bugs fixed are based on discussions
on the PNG-implement mailing list on the png-mng-implement mailing list
and not on material submitted privately to Guy, Andreas, or Glenn. They will and not on material submitted privately to Guy, Andreas, or Glenn. They will
forward any good suggestions to the list. forward any good suggestions to the list.
@@ -111,14 +114,14 @@ to subscribe) or to glennrp at users.sourceforge.net
You can't reach Guy, the original libpng author, at the addresses You can't reach Guy, the original libpng author, at the addresses
given in previous versions of this document. He and Andreas will read mail given in previous versions of this document. He and Andreas will read mail
addressed to the png-implement list, however. addressed to the png-mng-implement list, however.
Please do not send general questions about PNG. Send them to Please do not send general questions about PNG. Send them to
the (png-mng-misc at lists.sourceforge.net, subscription required, visit the (png-mng-misc at lists.sourceforge.net, subscription required, visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement to subscribe) https://lists.sourceforge.net/lists/listinfo/png-mng-implement to subscribe)
On the other hand, On the other hand,
please do not send libpng questions to that address, send them to me please do not send libpng questions to that address, send them to me
or to the png-implement list. I'll or to the png-mng-implement list. I'll
get them in the end anyway. If you have a question about something get them in the end anyway. If you have a question about something
in the PNG specification that is related to using libpng, send it in the PNG specification that is related to using libpng, send it
to me. Send me any questions that start with "I was using libpng, to me. Send me any questions that start with "I was using libpng,
@@ -191,11 +194,11 @@ Files in this distribution:
descrip.mms => VMS makefile for MMS or MMK descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning, makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng12.so.0.1.2.25) gcc, creates libpng12.so.0.1.2.33)
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.25) (gcc, creates libpng12.so.0.1.2.33)
makefile.gcmmx => Linux/ELF makefile makefile.gcmmx => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.25, (gcc, creates libpng12.so.0.1.2.33,
uses assembler code tuned for Intel MMX platform) uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
@@ -217,12 +220,12 @@ Files in this distribution:
makefile.openbsd => OpenBSD makefile makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics makefile.sggcc => Silicon Graphics
(gcc, creates libpng12.so.0.1.2.25) (gcc, creates libpng12.so.0.1.2.33)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng12.so.0.1.2.25) (gcc, creates libpng12.so.0.1.2.33)
makefile.so9 => Solaris 9 makefile makefile.so9 => Solaris 9 makefile
(gcc, creates libpng12.so.0.1.2.25) (gcc, creates libpng12.so.0.1.2.33)
makefile.32sunu => Sun Ultra 32-bit makefile makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
+2 -2
View File
@@ -1,13 +1,13 @@
Y2K compliance in libpng: Y2K compliance in libpng:
========================= =========================
February 18, 2008 October 31, 2008
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and 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.33 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer Libpng only has three year fields. One is a 2-byte unsigned integer
+531 -28
View File
File diff suppressed because it is too large Load Diff
+71 -15
View File
@@ -1,13 +1,17 @@
libpng.txt - A description on how to use and modify libpng libpng.txt - A description on how to use and modify libpng
libpng version 1.2.24 - December 14, 2007 libpng version 1.2.33 - October 31, 2008
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2007 Glenn Randers-Pehrson Copyright (c) 1998-2008 Glenn Randers-Pehrson
For conditions of distribution and use, see copyright For conditions of distribution and use, see copyright
notice in png.h. notice in png.h.
based on: Based on:
libpng versions 0.97, January 1998, through 1.2.33 - October 31, 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 libpng 1.0 beta 6 version 0.96 May 28, 1997
Updated and distributed by Andreas Dilger 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 W3C and ISO documents have identical technical content.
The PNG-1.2 specification is available at 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 The PNG-1.0 specification is available
as RFC 2083 <http://www.libpng.org/pub/png/documents/> and as a as RFC 2083 <http://www.libpng.org/pub/png/documents/> and as a
W3C Recommendation <http://www.w3.org/TR/REC.png.html>. Some W3C Recommendation <http://www.w3.org/TR/REC.png.html>.
additional chunks are described in the special-purpose public chunks
Some additional chunks are described in the special-purpose public chunks
documents at <http://www.libpng.org/pub/png/documents/>. documents at <http://www.libpng.org/pub/png/documents/>.
Other information Other information
@@ -260,15 +266,19 @@ input stream. You must supply the function
png_unknown_chunkp chunk); png_unknown_chunkp chunk);
{ {
/* The unknown chunk structure contains your /* 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 name[5];
png_byte *data; png_byte *data;
png_size_t size; png_size_t size;
/* Note that libpng has already taken care of /* Note that libpng has already taken care of
the CRC handling */ the CRC handling */
/* put your code here. Return one of the /* put your code here. Search for your chunk in the
following: */ unknown chunk structure, process it, and return one
of the following: */
return (-n); /* chunk had an error */ return (-n); /* chunk had an error */
return (0); /* did not recognize */ return (0); /* did not recognize */
@@ -288,6 +298,11 @@ you can retrieve with
png_get_user_chunk_ptr(png_ptr); 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 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 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. a progress meter or the like. It's demonstrated in pngtest.c.
@@ -332,13 +347,14 @@ Unknown-chunk handling
Now you get to set the way the library processes unknown chunks in the 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 input PNG stream. Both known and unknown chunks will be read. Normal
behavior is that known chunks will be parsed into information in 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. This
this, you can call: behavior can be wasteful if your application will never use some known
chunk types. To change this, you can call:
png_set_keep_unknown_chunks(png_ptr, keep, png_set_keep_unknown_chunks(png_ptr, keep,
chunk_list, num_chunks); chunk_list, num_chunks);
keep - 0: do not handle as unknown keep - 0: default unknown chunk handling
1: do not keep 1: ignore; do not keep
2: keep only if safe-to-copy 2: keep only if safe-to-copy
3: keep even if unsafe-to-copy 3: keep even if unsafe-to-copy
You can use these definitions: You can use these definitions:
@@ -361,6 +377,37 @@ instances of png_set_keep_unknown_chunks(), the final instance will
take precedence. The IHDR and IEND chunks should not be named in take precedence. The IHDR and IEND chunks should not be named in
chunk_list; if they are, libpng will process them normally anyway. 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 The high-level read interface
At this point there are two ways to proceed; through the high-level At this point there are two ways to proceed; through the high-level
@@ -804,6 +851,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 At the same time, png_set_gray_1_2_4_to_8() was deprecated, and it
will be removed from a future version. will be removed from a future version.
PNG can have files with 16 bits per channel. If you only can handle 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. 8 bits per channel, this will strip the pixels down to 8 bit.
@@ -1743,6 +1791,11 @@ Some of the more important parts of the png_info are:
can also be can also be
PNG_INTRAPIXEL_DIFFERENCING) 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, png_set_PLTE(png_ptr, info_ptr, palette,
num_palette); num_palette);
palette - the palette for the file palette - the palette for the file
@@ -2391,6 +2444,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 function will normally call png_error() if it receives a NULL from the
system memory allocator or from your replacement malloc_fn(). 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(), Input/Output in libpng is done through png_read() and png_write(),
which currently just call fread() and fwrite(). The FILE * is stored in 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 png_struct and is initialized via png_init_io(). If you wish to change
@@ -2796,13 +2852,13 @@ application:
IX. Y2K Compliance in libpng IX. Y2K Compliance in libpng
December 14, 2007 October 31, 2008
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.2.24 are Y2K compliant. It is my belief that earlier upward through 1.2.33 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that Libpng only has three year fields. One is a 2-byte unsigned integer that
+519 -3
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,4 +1,4 @@
.TH PNG 5 "February 18, 2008" .TH PNG 5 "October 31, 2008"
.SH NAME .SH NAME
png \- Portable Network Graphics (PNG) format png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION .SH DESCRIPTION
@@ -35,7 +35,7 @@ PNG 1.0 specification, October 1996:
RFC 2083 RFC 2083
.IP .IP
.br .br
ftp://ds.internic.net/rfc/rfc2083.txt ftp://ftp.rfc-editor.org:/in-notes/rfc2083.txt
.br .br
or (as a W3C Recommendation) at or (as a W3C Recommendation) at
.br .br
+5 -4
View File
@@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions /* png.c - location for general purpose libpng functions
* *
* Last changed in libpng 1.2.21 October 4, 2007 * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -13,7 +13,7 @@
#include "png.h" #include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */ /* 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_33 Your_png_h_is_not_version_1_2_33;
/* Version information for C files. This had better match the version /* Version information for C files. This had better match the version
* string defined in png.h. */ * string defined in png.h. */
@@ -380,11 +380,11 @@ if ((mask & PNG_FREE_TRNS) && (png_ptr->flags & PNG_FLAG_FREE_TRNS))
#endif #endif
{ {
png_free(png_ptr, info_ptr->trans); png_free(png_ptr, info_ptr->trans);
info_ptr->trans = NULL;
info_ptr->valid &= ~PNG_INFO_tRNS; info_ptr->valid &= ~PNG_INFO_tRNS;
#ifndef PNG_FREE_ME_SUPPORTED #ifndef PNG_FREE_ME_SUPPORTED
png_ptr->flags &= ~PNG_FLAG_FREE_TRNS; png_ptr->flags &= ~PNG_FLAG_FREE_TRNS;
#endif #endif
info_ptr->trans = NULL;
} }
#endif #endif
@@ -490,6 +490,7 @@ if (mask & PNG_FREE_SPLT)
png_free(png_ptr, png_ptr->unknown_chunk.data); png_free(png_ptr, png_ptr->unknown_chunk.data);
png_ptr->unknown_chunk.data = NULL; png_ptr->unknown_chunk.data = NULL;
} }
#ifdef PNG_FREE_ME_SUPPORTED #ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_UNKN) & info_ptr->free_me) if ((mask & PNG_FREE_UNKN) & info_ptr->free_me)
#else #else
@@ -693,7 +694,7 @@ png_charp PNGAPI
png_get_copyright(png_structp png_ptr) png_get_copyright(png_structp png_ptr)
{ {
png_ptr = png_ptr; /* silence compiler warning about unused 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.33 - October 31, 2008\n\
Copyright (c) 1998-2008 Glenn Randers-Pehrson\n\ Copyright (c) 1998-2008 Glenn Randers-Pehrson\n\
Copyright (c) 1996-1997 Andreas Dilger\n\ Copyright (c) 1996-1997 Andreas Dilger\n\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n"); Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
+61 -15
View File
@@ -1,7 +1,6 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.2.25 - February 18, 2008 * libpng version 1.2.33 - October 31, 2008
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -9,7 +8,7 @@
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * 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.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.33 - October 31, 2008: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@@ -177,6 +176,42 @@
* 1.2.24 13 10224 12.so.0.24[.0] * 1.2.24 13 10224 12.so.0.24[.0]
* 1.2.25beta01-06 13 10225 12.so.0.25[.0] * 1.2.25beta01-06 13 10225 12.so.0.25[.0]
* 1.2.25rc01-02 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]
* 1.0.37 10 10037 10.so.0.37[.0]
* 1.2.30beta01-04 13 10230 12.so.0.30[.0]
* 1.0.38rc01-08 10 10038 10.so.0.38[.0]
* 1.2.30rc01-08 13 10230 12.so.0.30[.0]
* 1.0.38 10 10038 10.so.0.38[.0]
* 1.2.30 13 10230 12.so.0.30[.0]
* 1.0.39rc01-03 10 10039 10.so.0.39[.0]
* 1.2.31rc01-03 13 10231 12.so.0.31[.0]
* 1.0.39 10 10039 10.so.0.39[.0]
* 1.2.31 13 10231 12.so.0.31[.0]
* 1.2.32beta01-02 13 10232 12.so.0.32[.0]
* 1.0.40rc01 10 10040 10.so.0.40[.0]
* 1.2.32rc01 13 10232 12.so.0.32[.0]
* 1.0.40 10 10040 10.so.0.40[.0]
* 1.2.32 13 10232 12.so.0.32[.0]
* 1.2.33beta01-02 13 10233 12.so.0.33[.0]
* 1.2.33rc01-02 13 10233 12.so.0.33[.0]
* 1.0.41rc01 10 10041 10.so.0.41[.0]
* 1.2.33 13 10233 12.so.0.33[.0]
* 1.0.41 10 10041 10.so.0.41[.0]
* *
* Henceforth the source version will match the shared-library major * Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be * and minor numbers; the shared-library major version number will be
@@ -186,7 +221,7 @@
* to the source version x.y.z (leading zeros in y and z). Beta versions * 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 * were given the previous public release number plus a letter, until
* version 1.0.6j; from then on they were given the upcoming public * 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 * Binary incompatibility exists only when applications make direct access
* to the info_ptr or png_ptr members through png.h, and the compiled * to the info_ptr or png_ptr members through png.h, and the compiled
@@ -206,7 +241,7 @@
* If you modify libpng you may insert additional notices immediately following * If you modify libpng you may insert additional notices immediately following
* this sentence. * 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.33, October 31, 2008, are
* Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are * Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5 * distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors: * with the following individual added to the list of Contributing Authors:
@@ -318,13 +353,13 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* February 18, 2008 * October 31, 2008
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
* *
* This is your unofficial assurance that libpng from version 0.71 and * 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.33 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant. * versions were also Y2K compliant.
* *
* Libpng only has three year fields. One is a 2-byte unsigned integer * Libpng only has three year fields. One is a 2-byte unsigned integer
@@ -380,9 +415,9 @@
*/ */
/* Version information for png.h - this should match the version in png.c */ /* 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.33"
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.2.25 - February 18, 2008\n" " libpng version 1.2.33 - October 31, 2008\n"
#define PNG_LIBPNG_VER_SONUM 0 #define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM 13 #define PNG_LIBPNG_VER_DLLNUM 13
@@ -390,7 +425,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 2 #define PNG_LIBPNG_VER_MINOR 2
#define PNG_LIBPNG_VER_RELEASE 25 #define PNG_LIBPNG_VER_RELEASE 33
/* This should match the numeric part of the final component of /* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */ * PNG_LIBPNG_VER_STRING, omitting any leading zero: */
@@ -418,7 +453,7 @@
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only * 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.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ * 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 10233 /* 1.2.33 */
#ifndef PNG_VERSION_INFO_ONLY #ifndef PNG_VERSION_INFO_ONLY
/* include the compression library's header */ /* include the compression library's header */
@@ -1189,7 +1224,7 @@ struct png_struct_def
png_uint_32 row_number; /* current row in interlace pass */ png_uint_32 row_number; /* current row in interlace pass */
png_bytep prev_row; /* buffer to save previous (unfiltered) row */ png_bytep prev_row; /* buffer to save previous (unfiltered) row */
png_bytep row_buf; /* buffer to save current (unfiltered) row */ png_bytep row_buf; /* buffer to save current (unfiltered) row */
#ifndef PNG_NO_WRITE_FILTERING #ifndef PNG_NO_WRITE_FILTER
png_bytep sub_row; /* buffer to save "sub" row when filtering */ png_bytep sub_row; /* buffer to save "sub" row when filtering */
png_bytep up_row; /* buffer to save "up" row when filtering */ png_bytep up_row; /* buffer to save "up" row when filtering */
png_bytep avg_row; /* buffer to save "avg" row when filtering */ png_bytep avg_row; /* buffer to save "avg" row when filtering */
@@ -1426,13 +1461,20 @@ struct png_struct_def
/* storage for unknown chunk that the library doesn't recognize. */ /* storage for unknown chunk that the library doesn't recognize. */
png_unknown_chunk unknown_chunk; png_unknown_chunk unknown_chunk;
#endif #endif
/* New members added in libpng-1.2.26 */
png_uint_32 old_big_row_buf_size, old_prev_row_size;
/* New member added in libpng-1.2.30 */
png_charp chunkdata; /* buffer for reading chunk data */
}; };
/* This triggers a compiler error in png.c, if png.c and png.h /* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number. * do not agree upon the version number.
*/ */
typedef png_structp version_1_2_25; typedef png_structp version_1_2_33;
typedef png_struct FAR * FAR * png_structpp; typedef png_struct FAR * FAR * png_structpp;
@@ -2627,6 +2669,7 @@ extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
png_ptr)); png_ptr));
#endif #endif
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */ /* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
@@ -3008,8 +3051,8 @@ PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
/* Decompress data in a chunk that uses compression */ /* Decompress data in a chunk that uses compression */
#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \ #if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr, PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr,
int comp_type, png_charp chunkdata, png_size_t chunklength, int comp_type, png_size_t chunklength,
png_size_t prefix_length, png_size_t *data_length)); png_size_t prefix_length, png_size_t *data_length));
#endif #endif
@@ -3538,6 +3581,9 @@ png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
#endif /* PNG_pHYs_SUPPORTED */ #endif /* PNG_pHYs_SUPPORTED */
#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */ #endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
/* Read the chunk header (length + type name) */
PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr));
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
#endif /* PNG_INTERNAL */ #endif /* PNG_INTERNAL */
+1 -1
View File
@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.2.25 - February 18, 2008 * libpng version 1.2.33 - October 31, 2008
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+13 -11
View File
@@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* Last changed in libpng 1.2.22 [October 13, 2007] * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -15,8 +15,8 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
static void /* PRIVATE */ static void /* PRIVATE */
png_default_error PNGARG((png_structp png_ptr, png_default_error PNGARG((png_structp png_ptr,
png_const_charp error_message)); png_const_charp error_message));
@@ -44,16 +44,17 @@ png_error(png_structp png_ptr, png_const_charp error_message)
{ {
if (*error_message == '#') if (*error_message == '#')
{ {
/* Strip "#nnnn " from beginning of error message. */
int offset; int offset;
for (offset=1; offset<15; offset++) for (offset=1; offset<15; offset++)
if (*(error_message+offset) == ' ') if (error_message[offset] == ' ')
break; break;
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT) if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{ {
int i; int i;
for (i=0; i<offset-1; i++) for (i=0; i<offset-1; i++)
msg[i]=error_message[i+1]; msg[i]=error_message[i+1];
msg[i]='\0'; msg[i - 1] = '\0';
error_message=msg; error_message=msg;
} }
else else
@@ -111,7 +112,7 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
if (*warning_message == '#') if (*warning_message == '#')
{ {
for (offset=1; offset<15; offset++) for (offset=1; offset<15; offset++)
if (*(warning_message+offset) == ' ') if (warning_message[offset] == ' ')
break; break;
} }
} }
@@ -216,19 +217,20 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*error_message == '#') if (*error_message == '#')
{ {
/* Strip "#nnnn " from beginning of warning message. */
int offset; int offset;
char error_number[16]; char error_number[16];
for (offset=0; offset<15; offset++) for (offset=0; offset<15; offset++)
{ {
error_number[offset] = *(error_message+offset+1); error_number[offset] = error_message[offset + 1];
if (*(error_message+offset) == ' ') if (error_message[offset] == ' ')
break; break;
} }
if((offset > 1) && (offset < 15)) if((offset > 1) && (offset < 15))
{ {
error_number[offset-1]='\0'; error_number[offset-1]='\0';
fprintf(stderr, "libpng error no. %s: %s\n", error_number, fprintf(stderr, "libpng error no. %s: %s\n", error_number,
error_message+offset); error_message + offset + 1);
} }
else else
fprintf(stderr, "libpng error: %s, offset=%d\n", error_message,offset); fprintf(stderr, "libpng error: %s, offset=%d\n", error_message,offset);
@@ -276,13 +278,13 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
char warning_number[16]; char warning_number[16];
for (offset=0; offset<15; offset++) for (offset=0; offset<15; offset++)
{ {
warning_number[offset]=*(warning_message+offset+1); warning_number[offset] = warning_message[offset + 1];
if (*(warning_message+offset) == ' ') if (warning_message[offset] == ' ')
break; break;
} }
if((offset > 1) && (offset < 15)) if((offset > 1) && (offset < 15))
{ {
warning_number[offset-1]='\0'; warning_number[offset + 1] = '\0';
fprintf(stderr, "libpng warning no. %s: %s\n", warning_number, fprintf(stderr, "libpng warning no. %s: %s\n", warning_number,
warning_message+offset); warning_message+offset);
} }
+1 -2
View File
@@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* Last changed in libpng 1.2.15 January 5, 2007 * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -10,7 +10,6 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
png_uint_32 PNGAPI png_uint_32 PNGAPI
+6 -5
View File
@@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* Last changed in libpng 1.2.13 November 13, 2006 * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -16,7 +16,6 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
/* Borland DOS special memory handler */ /* Borland DOS special memory handler */
@@ -273,6 +272,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
/* free a pointer allocated by png_malloc(). In the default /* free a pointer allocated by png_malloc(). In the default
configuration, png_ptr is not used, but is passed in case it configuration, png_ptr is not used, but is passed in case it
is needed. If ptr is NULL, return without taking any action. */ is needed. If ptr is NULL, return without taking any action. */
void PNGAPI void PNGAPI
png_free(png_structp png_ptr, png_voidp ptr) png_free(png_structp png_ptr, png_voidp ptr)
{ {
@@ -293,7 +293,7 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
if(png_ptr == NULL) return; if (png_ptr == NULL || ptr == NULL) return;
if (png_ptr->offset_table != NULL) 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) if (size > (png_uint_32)65536L)
{ {
#ifndef PNG_USER_MEM_SUPPORTED #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"); png_error(png_ptr, "Cannot Allocate > 64K");
else else
#endif #endif
@@ -587,7 +587,8 @@ void PNGAPI
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
malloc_fn, png_free_ptr free_fn) malloc_fn, png_free_ptr free_fn)
{ {
if(png_ptr != NULL) { if (png_ptr != NULL)
{
png_ptr->mem_ptr = mem_ptr; png_ptr->mem_ptr = mem_ptr;
png_ptr->malloc_fn = malloc_fn; png_ptr->malloc_fn = malloc_fn;
png_ptr->free_fn = free_fn; png_ptr->free_fn = free_fn;
+33 -30
View File
@@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode /* 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.32 [September 18, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -10,7 +10,6 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
/* push model modes */ /* push model modes */
@@ -213,6 +212,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_ptr->push_length = png_get_uint_31(png_ptr,chunk_length); png_ptr->push_length = png_get_uint_31(png_ptr,chunk_length);
png_reset_crc(png_ptr); png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4); png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
} }
@@ -222,6 +222,8 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4)) if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4))
{ {
if (png_ptr->push_length != 13)
png_error(png_ptr, "Invalid IHDR length");
if (png_ptr->push_length + 4 > png_ptr->buffer_size) if (png_ptr->push_length + 4 > png_ptr->buffer_size)
{ {
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
@@ -1018,23 +1020,21 @@ png_read_push_finish_row(png_structp png_ptr)
png_ptr->rowbytes + 1); png_ptr->rowbytes + 1);
do do
{ {
int pass; png_ptr->pass++;
pass = png_ptr->pass; if ((png_ptr->pass == 1 && png_ptr->width < 5) ||
pass++; (png_ptr->pass == 3 && png_ptr->width < 3) ||
if ((pass == 1 && png_ptr->width < 5) || (png_ptr->pass == 5 && png_ptr->width < 2))
(pass == 3 && png_ptr->width < 3) || png_ptr->pass++;
(pass == 5 && png_ptr->width < 2))
pass++; if (png_ptr->pass > 7)
png_ptr->pass--;
if (png_ptr->pass >= 7)
break;
if (pass > 7)
pass--;
png_ptr->pass = (png_byte) pass;
if (pass < 7)
{
png_ptr->iwidth = (png_ptr->width + png_ptr->iwidth = (png_ptr->width +
png_pass_inc[pass] - 1 - png_pass_inc[png_ptr->pass] - 1 -
png_pass_start[pass]) / png_pass_start[png_ptr->pass]) /
png_pass_inc[pass]; png_pass_inc[png_ptr->pass];
png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,
png_ptr->iwidth) + 1; png_ptr->iwidth) + 1;
@@ -1043,12 +1043,9 @@ png_read_push_finish_row(png_structp png_ptr)
break; break;
png_ptr->num_rows = (png_ptr->height + png_ptr->num_rows = (png_ptr->height +
png_pass_yinc[pass] - 1 - png_pass_yinc[png_ptr->pass] - 1 -
png_pass_ystart[pass]) / png_pass_ystart[png_ptr->pass]) /
png_pass_yinc[pass]; png_pass_yinc[png_ptr->pass];
}
else
break;
} while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0); } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
} }
@@ -1266,8 +1263,8 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
if (text == NULL) if (text == NULL)
{ {
text = (png_charp)png_malloc(png_ptr, text = (png_charp)png_malloc(png_ptr,
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out (png_uint_32)(png_ptr->zbuf_size
+ key_size + 1)); - png_ptr->zstream.avail_out + key_size + 1));
png_memcpy(text + key_size, png_ptr->zbuf, png_memcpy(text + key_size, png_ptr->zbuf,
png_ptr->zbuf_size - png_ptr->zstream.avail_out); png_ptr->zbuf_size - png_ptr->zstream.avail_out);
png_memcpy(text, key, key_size); png_memcpy(text, key, key_size);
@@ -1281,8 +1278,8 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
tmp = text; tmp = text;
text = (png_charp)png_malloc(png_ptr, text_size + text = (png_charp)png_malloc(png_ptr, text_size +
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out (png_uint_32)(png_ptr->zbuf_size
+ 1)); - png_ptr->zstream.avail_out + 1));
png_memcpy(text, tmp, text_size); png_memcpy(text, tmp, text_size);
png_free(png_ptr, tmp); png_free(png_ptr, tmp);
png_memcpy(text + text_size, png_ptr->zbuf, png_memcpy(text + text_size, png_ptr->zbuf,
@@ -1467,7 +1464,6 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
length) length)
{ {
png_uint_32 skip=0; png_uint_32 skip=0;
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
if (!(png_ptr->chunk_name[0] & 0x20)) if (!(png_ptr->chunk_name[0] & 0x20))
{ {
@@ -1498,11 +1494,18 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
png_memcpy((png_charp)png_ptr->unknown_chunk.name, png_memcpy((png_charp)png_ptr->unknown_chunk.name,
(png_charp)png_ptr->chunk_name, (png_charp)png_ptr->chunk_name,
png_sizeof(png_ptr->unknown_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.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_ptr->unknown_chunk.size = (png_size_t)length;
if (length == 0)
png_ptr->unknown_chunk.data = NULL;
else
{
png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr,
(png_uint_32)length);
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
}
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) #if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
if(png_ptr->read_user_chunk_fn != NULL) if(png_ptr->read_user_chunk_fn != NULL)
{ {
+63 -83
View File
@@ -1,7 +1,7 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* Last changed in libpng 1.2.25 [February 18, 2008] * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -13,7 +13,6 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) #if defined(PNG_READ_SUPPORTED)
/* Create a PNG structure for reading, and allocate any memory needed. */ /* Create a PNG structure for reading, and allocate any memory needed. */
@@ -35,6 +34,9 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
#ifdef PNG_SETJMP_SUPPORTED
volatile
#endif
png_structp png_ptr; png_structp png_ptr;
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
@@ -406,38 +408,29 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
PNG_CONST PNG_zTXt; PNG_CONST PNG_zTXt;
#endif #endif
#endif /* PNG_USE_LOCAL_ARRAYS */ #endif /* PNG_USE_LOCAL_ARRAYS */
png_byte chunk_length[4]; png_uint_32 length = png_read_chunk_header(png_ptr);
png_uint_32 length; PNG_CONST png_bytep chunk_name = png_ptr->chunk_name;
png_read_data(png_ptr, chunk_length, 4);
length = png_get_uint_31(png_ptr,chunk_length);
png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_debug2(0, "Reading %s chunk, length=%lu.\n", png_ptr->chunk_name,
length);
/* This should be a binary subdivision search or a hash for /* This should be a binary subdivision search or a hash for
* matching the chunk name rather than a linear search. * matching the chunk name rather than a linear search.
*/ */
if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) if (!png_memcmp(chunk_name, png_IDAT, 4))
if(png_ptr->mode & PNG_AFTER_IDAT) if(png_ptr->mode & PNG_AFTER_IDAT)
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT; png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4)) if (!png_memcmp(chunk_name, png_IHDR, 4))
png_handle_IHDR(png_ptr, info_ptr, length); png_handle_IHDR(png_ptr, info_ptr, length);
else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4)) else if (!png_memcmp(chunk_name, png_IEND, 4))
png_handle_IEND(png_ptr, info_ptr, length); png_handle_IEND(png_ptr, info_ptr, length);
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
else if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name)) else if (png_handle_as_unknown(png_ptr, chunk_name))
{ {
if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) if (!png_memcmp(chunk_name, png_IDAT, 4))
png_ptr->mode |= PNG_HAVE_IDAT; png_ptr->mode |= PNG_HAVE_IDAT;
png_handle_unknown(png_ptr, info_ptr, length); png_handle_unknown(png_ptr, info_ptr, length);
if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) if (!png_memcmp(chunk_name, png_PLTE, 4))
png_ptr->mode |= PNG_HAVE_PLTE; png_ptr->mode |= PNG_HAVE_PLTE;
else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) else if (!png_memcmp(chunk_name, png_IDAT, 4))
{ {
if (!(png_ptr->mode & PNG_HAVE_IHDR)) if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before IDAT"); png_error(png_ptr, "Missing IHDR before IDAT");
@@ -448,9 +441,9 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
} }
} }
#endif #endif
else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) else if (!png_memcmp(chunk_name, png_PLTE, 4))
png_handle_PLTE(png_ptr, info_ptr, length); png_handle_PLTE(png_ptr, info_ptr, length);
else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) else if (!png_memcmp(chunk_name, png_IDAT, 4))
{ {
if (!(png_ptr->mode & PNG_HAVE_IHDR)) if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before IDAT"); png_error(png_ptr, "Missing IHDR before IDAT");
@@ -463,71 +456,71 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
break; break;
} }
#if defined(PNG_READ_bKGD_SUPPORTED) #if defined(PNG_READ_bKGD_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4)) else if (!png_memcmp(chunk_name, png_bKGD, 4))
png_handle_bKGD(png_ptr, info_ptr, length); png_handle_bKGD(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_cHRM_SUPPORTED) #if defined(PNG_READ_cHRM_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4)) else if (!png_memcmp(chunk_name, png_cHRM, 4))
png_handle_cHRM(png_ptr, info_ptr, length); png_handle_cHRM(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_gAMA_SUPPORTED) #if defined(PNG_READ_gAMA_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4)) else if (!png_memcmp(chunk_name, png_gAMA, 4))
png_handle_gAMA(png_ptr, info_ptr, length); png_handle_gAMA(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_hIST_SUPPORTED) #if defined(PNG_READ_hIST_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4)) else if (!png_memcmp(chunk_name, png_hIST, 4))
png_handle_hIST(png_ptr, info_ptr, length); png_handle_hIST(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_oFFs_SUPPORTED) #if defined(PNG_READ_oFFs_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4)) else if (!png_memcmp(chunk_name, png_oFFs, 4))
png_handle_oFFs(png_ptr, info_ptr, length); png_handle_oFFs(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_pCAL_SUPPORTED) #if defined(PNG_READ_pCAL_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4)) else if (!png_memcmp(chunk_name, png_pCAL, 4))
png_handle_pCAL(png_ptr, info_ptr, length); png_handle_pCAL(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sCAL_SUPPORTED) #if defined(PNG_READ_sCAL_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4)) else if (!png_memcmp(chunk_name, png_sCAL, 4))
png_handle_sCAL(png_ptr, info_ptr, length); png_handle_sCAL(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_pHYs_SUPPORTED) #if defined(PNG_READ_pHYs_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4)) else if (!png_memcmp(chunk_name, png_pHYs, 4))
png_handle_pHYs(png_ptr, info_ptr, length); png_handle_pHYs(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sBIT_SUPPORTED) #if defined(PNG_READ_sBIT_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4)) else if (!png_memcmp(chunk_name, png_sBIT, 4))
png_handle_sBIT(png_ptr, info_ptr, length); png_handle_sBIT(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sRGB_SUPPORTED) #if defined(PNG_READ_sRGB_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4)) else if (!png_memcmp(chunk_name, png_sRGB, 4))
png_handle_sRGB(png_ptr, info_ptr, length); png_handle_sRGB(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_iCCP_SUPPORTED) #if defined(PNG_READ_iCCP_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4)) else if (!png_memcmp(chunk_name, png_iCCP, 4))
png_handle_iCCP(png_ptr, info_ptr, length); png_handle_iCCP(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sPLT_SUPPORTED) #if defined(PNG_READ_sPLT_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4)) else if (!png_memcmp(chunk_name, png_sPLT, 4))
png_handle_sPLT(png_ptr, info_ptr, length); png_handle_sPLT(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_tEXt_SUPPORTED) #if defined(PNG_READ_tEXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4)) else if (!png_memcmp(chunk_name, png_tEXt, 4))
png_handle_tEXt(png_ptr, info_ptr, length); png_handle_tEXt(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_tIME_SUPPORTED) #if defined(PNG_READ_tIME_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4)) else if (!png_memcmp(chunk_name, png_tIME, 4))
png_handle_tIME(png_ptr, info_ptr, length); png_handle_tIME(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_tRNS_SUPPORTED) #if defined(PNG_READ_tRNS_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4)) else if (!png_memcmp(chunk_name, png_tRNS, 4))
png_handle_tRNS(png_ptr, info_ptr, length); png_handle_tRNS(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_zTXt_SUPPORTED) #if defined(PNG_READ_zTXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4)) else if (!png_memcmp(chunk_name, png_zTXt, 4))
png_handle_zTXt(png_ptr, info_ptr, length); png_handle_zTXt(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_iTXt_SUPPORTED) #if defined(PNG_READ_iTXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4)) else if (!png_memcmp(chunk_name, png_iTXt, 4))
png_handle_iTXt(png_ptr, info_ptr, length); png_handle_iTXt(png_ptr, info_ptr, length);
#endif #endif
else else
@@ -703,15 +696,9 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
{ {
while (!png_ptr->idat_size) while (!png_ptr->idat_size)
{ {
png_byte chunk_length[4];
png_crc_finish(png_ptr, 0); png_crc_finish(png_ptr, 0);
png_read_data(png_ptr, chunk_length, 4); png_ptr->idat_size = png_read_chunk_header(png_ptr);
png_ptr->idat_size = png_get_uint_31(png_ptr,chunk_length);
png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
png_error(png_ptr, "Not enough image data"); png_error(png_ptr, "Not enough image data");
} }
@@ -920,9 +907,6 @@ png_read_image(png_structp png_ptr, png_bytepp image)
void PNGAPI void PNGAPI
png_read_end(png_structp png_ptr, png_infop info_ptr) png_read_end(png_structp png_ptr, png_infop info_ptr)
{ {
png_byte chunk_length[4];
png_uint_32 length;
png_debug(1, "in png_read_end\n"); png_debug(1, "in png_read_end\n");
if(png_ptr == NULL) return; if(png_ptr == NULL) return;
png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */ png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */
@@ -986,33 +970,27 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
PNG_CONST PNG_zTXt; PNG_CONST PNG_zTXt;
#endif #endif
#endif /* PNG_USE_LOCAL_ARRAYS */ #endif /* PNG_USE_LOCAL_ARRAYS */
png_uint_32 length = png_read_chunk_header(png_ptr);
PNG_CONST png_bytep chunk_name = png_ptr->chunk_name;
png_read_data(png_ptr, chunk_length, 4); if (!png_memcmp(chunk_name, png_IHDR, 4))
length = png_get_uint_31(png_ptr,chunk_length);
png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_debug1(0, "Reading %s chunk.\n", png_ptr->chunk_name);
if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4))
png_handle_IHDR(png_ptr, info_ptr, length); png_handle_IHDR(png_ptr, info_ptr, length);
else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4)) else if (!png_memcmp(chunk_name, png_IEND, 4))
png_handle_IEND(png_ptr, info_ptr, length); png_handle_IEND(png_ptr, info_ptr, length);
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
else if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name)) else if (png_handle_as_unknown(png_ptr, chunk_name))
{ {
if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) if (!png_memcmp(chunk_name, png_IDAT, 4))
{ {
if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT)) if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT))
png_error(png_ptr, "Too many IDAT's found"); png_error(png_ptr, "Too many IDAT's found");
} }
png_handle_unknown(png_ptr, info_ptr, length); png_handle_unknown(png_ptr, info_ptr, length);
if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) if (!png_memcmp(chunk_name, png_PLTE, 4))
png_ptr->mode |= PNG_HAVE_PLTE; png_ptr->mode |= PNG_HAVE_PLTE;
} }
#endif #endif
else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) else if (!png_memcmp(chunk_name, png_IDAT, 4))
{ {
/* Zero length IDATs are legal after the last IDAT has been /* Zero length IDATs are legal after the last IDAT has been
* read, but not after other chunks have been read. * read, but not after other chunks have been read.
@@ -1021,74 +999,74 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
png_error(png_ptr, "Too many IDAT's found"); png_error(png_ptr, "Too many IDAT's found");
png_crc_finish(png_ptr, length); png_crc_finish(png_ptr, length);
} }
else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) else if (!png_memcmp(chunk_name, png_PLTE, 4))
png_handle_PLTE(png_ptr, info_ptr, length); png_handle_PLTE(png_ptr, info_ptr, length);
#if defined(PNG_READ_bKGD_SUPPORTED) #if defined(PNG_READ_bKGD_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4)) else if (!png_memcmp(chunk_name, png_bKGD, 4))
png_handle_bKGD(png_ptr, info_ptr, length); png_handle_bKGD(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_cHRM_SUPPORTED) #if defined(PNG_READ_cHRM_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4)) else if (!png_memcmp(chunk_name, png_cHRM, 4))
png_handle_cHRM(png_ptr, info_ptr, length); png_handle_cHRM(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_gAMA_SUPPORTED) #if defined(PNG_READ_gAMA_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4)) else if (!png_memcmp(chunk_name, png_gAMA, 4))
png_handle_gAMA(png_ptr, info_ptr, length); png_handle_gAMA(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_hIST_SUPPORTED) #if defined(PNG_READ_hIST_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4)) else if (!png_memcmp(chunk_name, png_hIST, 4))
png_handle_hIST(png_ptr, info_ptr, length); png_handle_hIST(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_oFFs_SUPPORTED) #if defined(PNG_READ_oFFs_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4)) else if (!png_memcmp(chunk_name, png_oFFs, 4))
png_handle_oFFs(png_ptr, info_ptr, length); png_handle_oFFs(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_pCAL_SUPPORTED) #if defined(PNG_READ_pCAL_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4)) else if (!png_memcmp(chunk_name, png_pCAL, 4))
png_handle_pCAL(png_ptr, info_ptr, length); png_handle_pCAL(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sCAL_SUPPORTED) #if defined(PNG_READ_sCAL_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4)) else if (!png_memcmp(chunk_name, png_sCAL, 4))
png_handle_sCAL(png_ptr, info_ptr, length); png_handle_sCAL(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_pHYs_SUPPORTED) #if defined(PNG_READ_pHYs_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4)) else if (!png_memcmp(chunk_name, png_pHYs, 4))
png_handle_pHYs(png_ptr, info_ptr, length); png_handle_pHYs(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sBIT_SUPPORTED) #if defined(PNG_READ_sBIT_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4)) else if (!png_memcmp(chunk_name, png_sBIT, 4))
png_handle_sBIT(png_ptr, info_ptr, length); png_handle_sBIT(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sRGB_SUPPORTED) #if defined(PNG_READ_sRGB_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4)) else if (!png_memcmp(chunk_name, png_sRGB, 4))
png_handle_sRGB(png_ptr, info_ptr, length); png_handle_sRGB(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_iCCP_SUPPORTED) #if defined(PNG_READ_iCCP_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4)) else if (!png_memcmp(chunk_name, png_iCCP, 4))
png_handle_iCCP(png_ptr, info_ptr, length); png_handle_iCCP(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sPLT_SUPPORTED) #if defined(PNG_READ_sPLT_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4)) else if (!png_memcmp(chunk_name, png_sPLT, 4))
png_handle_sPLT(png_ptr, info_ptr, length); png_handle_sPLT(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_tEXt_SUPPORTED) #if defined(PNG_READ_tEXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4)) else if (!png_memcmp(chunk_name, png_tEXt, 4))
png_handle_tEXt(png_ptr, info_ptr, length); png_handle_tEXt(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_tIME_SUPPORTED) #if defined(PNG_READ_tIME_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4)) else if (!png_memcmp(chunk_name, png_tIME, 4))
png_handle_tIME(png_ptr, info_ptr, length); png_handle_tIME(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_tRNS_SUPPORTED) #if defined(PNG_READ_tRNS_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4)) else if (!png_memcmp(chunk_name, png_tRNS, 4))
png_handle_tRNS(png_ptr, info_ptr, length); png_handle_tRNS(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_zTXt_SUPPORTED) #if defined(PNG_READ_zTXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4)) else if (!png_memcmp(chunk_name, png_zTXt, 4))
png_handle_zTXt(png_ptr, info_ptr, length); png_handle_zTXt(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_iTXt_SUPPORTED) #if defined(PNG_READ_iTXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4)) else if (!png_memcmp(chunk_name, png_iTXt, 4))
png_handle_iTXt(png_ptr, info_ptr, length); png_handle_iTXt(png_ptr, info_ptr, length);
#endif #endif
else else
@@ -1111,9 +1089,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
png_debug(1, "in png_destroy_read_struct\n"); png_debug(1, "in png_destroy_read_struct\n");
if (png_ptr_ptr != NULL) if (png_ptr_ptr != NULL)
{
png_ptr = *png_ptr_ptr; png_ptr = *png_ptr_ptr;
}
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
@@ -1159,6 +1135,8 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
*end_info_ptr_ptr = NULL; *end_info_ptr_ptr = NULL;
} }
if (png_ptr != NULL)
{
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn, png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn,
(png_voidp)mem_ptr); (png_voidp)mem_ptr);
@@ -1167,6 +1145,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
#endif #endif
*png_ptr_ptr = NULL; *png_ptr_ptr = NULL;
} }
}
/* free all memory used by the read (old method) */ /* free all memory used by the read (old method) */
void /* PRIVATE */ void /* PRIVATE */
@@ -1192,6 +1171,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
png_free(png_ptr, png_ptr->zbuf); png_free(png_ptr, png_ptr->zbuf);
png_free(png_ptr, png_ptr->big_row_buf); png_free(png_ptr, png_ptr->big_row_buf);
png_free(png_ptr, png_ptr->prev_row); png_free(png_ptr, png_ptr->prev_row);
png_free(png_ptr, png_ptr->chunkdata);
#if defined(PNG_READ_DITHER_SUPPORTED) #if defined(PNG_READ_DITHER_SUPPORTED)
png_free(png_ptr, png_ptr->palette_lookup); png_free(png_ptr, png_ptr->palette_lookup);
png_free(png_ptr, png_ptr->dither_index); png_free(png_ptr, png_ptr->dither_index);
+1 -2
View File
@@ -1,7 +1,7 @@
/* pngrio.c - functions for data input /* pngrio.c - functions for data input
* *
* Last changed in libpng 1.2.13 November 13, 2006 * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -17,7 +17,6 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) #if defined(PNG_READ_SUPPORTED)
/* Read the data from whatever input you are using. The default routine /* Read the data from whatever input you are using. The default routine
+17 -20
View File
@@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers /* 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.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -15,7 +15,6 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) #if defined(PNG_READ_SUPPORTED)
/* Set the action on getting a CRC error for an ancillary or critical chunk. */ /* Set the action on getting a CRC error for an ancillary or critical chunk. */
@@ -39,7 +38,8 @@ png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
PNG_FLAG_CRC_CRITICAL_IGNORE; PNG_FLAG_CRC_CRITICAL_IGNORE;
break; break;
case PNG_CRC_WARN_DISCARD: /* not a valid action for critical data */ case PNG_CRC_WARN_DISCARD: /* not a valid action for critical data */
png_warning(png_ptr, "Can't discard critical data on CRC error."); png_warning(png_ptr,
"Can't discard critical data on CRC error.");
case PNG_CRC_ERROR_QUIT: /* error/quit */ case PNG_CRC_ERROR_QUIT: /* error/quit */
case PNG_CRC_DEFAULT: case PNG_CRC_DEFAULT:
default: default:
@@ -548,9 +548,7 @@ png_set_expand(png_structp png_ptr)
png_debug(1, "in png_set_expand\n"); png_debug(1, "in png_set_expand\n");
if(png_ptr == NULL) return; if(png_ptr == NULL) return;
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
#ifdef PNG_WARN_UNINITIALIZED_ROW
png_ptr->flags &= ~PNG_FLAG_ROW_INIT; png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
#endif
} }
/* GRR 19990627: the following three functions currently are identical /* 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"); png_debug(1, "in png_set_palette_to_rgb\n");
if(png_ptr == NULL) return; if(png_ptr == NULL) return;
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
#ifdef PNG_WARN_UNINITIALIZED_ROW
png_ptr->flags &= ~PNG_FLAG_ROW_INIT; png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
#endif
} }
#if !defined(PNG_1_0_X) #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"); png_debug(1, "in png_set_expand_gray_1_2_4_to_8\n");
if(png_ptr == NULL) return; if(png_ptr == NULL) return;
png_ptr->transformations |= PNG_EXPAND; png_ptr->transformations |= PNG_EXPAND;
#ifdef PNG_WARN_UNINITIALIZED_ROW
png_ptr->flags &= ~PNG_FLAG_ROW_INIT; png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
#endif
} }
#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_debug(1, "in png_set_tRNS_to_alpha\n");
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
#ifdef PNG_WARN_UNINITIALIZED_ROW
png_ptr->flags &= ~PNG_FLAG_ROW_INIT; png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
#endif
} }
#endif /* defined(PNG_READ_EXPAND_SUPPORTED) */ #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_debug(1, "in png_set_gray_to_rgb\n");
png_ptr->transformations |= PNG_GRAY_TO_RGB; png_ptr->transformations |= PNG_GRAY_TO_RGB;
#ifdef PNG_WARN_UNINITIALIZED_ROW
png_ptr->flags &= ~PNG_FLAG_ROW_INIT; png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
#endif
} }
#endif #endif
@@ -669,7 +659,8 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
png_ptr->transformations |= PNG_EXPAND; png_ptr->transformations |= PNG_EXPAND;
#else #else
{ {
png_warning(png_ptr, "Cannot do RGB_TO_GRAY without EXPAND_SUPPORTED."); png_warning(png_ptr,
"Cannot do RGB_TO_GRAY without EXPAND_SUPPORTED.");
png_ptr->transformations &= ~PNG_RGB_TO_GRAY; png_ptr->transformations &= ~PNG_RGB_TO_GRAY;
} }
#endif #endif
@@ -693,7 +684,8 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
} }
png_ptr->rgb_to_gray_red_coeff = red_int; png_ptr->rgb_to_gray_red_coeff = red_int;
png_ptr->rgb_to_gray_green_coeff = green_int; png_ptr->rgb_to_gray_green_coeff = green_int;
png_ptr->rgb_to_gray_blue_coeff = (png_uint_16)(32768-red_int-green_int); png_ptr->rgb_to_gray_blue_coeff =
(png_uint_16)(32768 - red_int - green_int);
} }
} }
#endif #endif
@@ -967,7 +959,7 @@ png_init_read_transformations(png_structp png_ptr)
/* Prevent the transformations being done again, and make sure /* Prevent the transformations being done again, and make sure
* that the now spurious alpha channel is stripped - the code * that the now spurious alpha channel is stripped - the code
* has just reduced background composition and gamma correction * 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_BACKGROUND;
png_ptr->transformations &= ~PNG_GAMMA; png_ptr->transformations &= ~PNG_GAMMA;
@@ -1138,7 +1130,8 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
{ {
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) 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; info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
else else
info_ptr->color_type = PNG_COLOR_TYPE_RGB; info_ptr->color_type = PNG_COLOR_TYPE_RGB;
@@ -1151,8 +1144,10 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr->transformations & PNG_EXPAND_tRNS) if (png_ptr->transformations & PNG_EXPAND_tRNS)
info_ptr->color_type |= PNG_COLOR_MASK_ALPHA; info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
#if 0 /* Removed from libpng-1.2.27 */
else else
info_ptr->color_type |= PNG_COLOR_MASK_COLOR; info_ptr->color_type |= PNG_COLOR_MASK_COLOR;
#endif
} }
if (info_ptr->bit_depth < 8) if (info_ptr->bit_depth < 8)
info_ptr->bit_depth = 8; info_ptr->bit_depth = 8;
@@ -1280,7 +1275,7 @@ png_do_read_transformations(png_structp png_ptr)
char msg[50]; char msg[50];
png_snprintf2(msg, 50, png_snprintf2(msg, 50,
"NULL row buffer for row %ld, pass %d", png_ptr->row_number, "NULL row buffer for row %ld, pass %d", (long)png_ptr->row_number,
png_ptr->pass); png_ptr->pass);
png_error(png_ptr, msg); png_error(png_ptr, msg);
#else #else
@@ -2217,8 +2212,10 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
/* reduce RGB files to grayscale, with or without alpha /* reduce RGB files to grayscale, with or without alpha
* using the equation given in Poynton's ColorFAQ at * using the equation given in Poynton's ColorFAQ at
* <http://www.inforamp.net/~poynton/> * <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008)
* Copyright (c) 1998-01-04 Charles Poynton poynton at inforamp.net * New link:
* <http://www.poynton.com/notes/colour_and_gamma/>
* Charles Poynton poynton at poynton.com
* *
* Y = 0.212671 * R + 0.715160 * G + 0.072169 * B * Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
* *
+251 -181
View File
File diff suppressed because it is too large Load Diff
+69 -29
View File
@@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct /* 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.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -15,7 +15,6 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#if defined(PNG_bKGD_SUPPORTED) #if defined(PNG_bKGD_SUPPORTED)
@@ -396,7 +395,8 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
return; return;
length = png_strlen(purpose) + 1; length = png_strlen(purpose) + 1;
png_debug1(3, "allocating purpose for info (%lu bytes)\n", length); png_debug1(3, "allocating purpose for info (%lu bytes)\n",
(unsigned long)length);
info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length); info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_purpose == NULL) if (info_ptr->pcal_purpose == NULL)
{ {
@@ -412,7 +412,8 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
info_ptr->pcal_nparams = (png_byte)nparams; info_ptr->pcal_nparams = (png_byte)nparams;
length = png_strlen(units) + 1; length = png_strlen(units) + 1;
png_debug1(3, "allocating units for info (%lu bytes)\n", length); png_debug1(3, "allocating units for info (%lu bytes)\n",
(unsigned long)length);
info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length); info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_units == NULL) if (info_ptr->pcal_units == NULL)
{ {
@@ -434,7 +435,8 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
for (i = 0; i < nparams; i++) for (i = 0; i < nparams; i++)
{ {
length = png_strlen(params[i]) + 1; length = png_strlen(params[i]) + 1;
png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i, length); png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i,
(unsigned long)length);
info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length); info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_params[i] == NULL) if (info_ptr->pcal_params[i] == NULL)
{ {
@@ -482,7 +484,8 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
info_ptr->scal_unit = (png_byte)unit; info_ptr->scal_unit = (png_byte)unit;
length = png_strlen(swidth) + 1; length = png_strlen(swidth) + 1;
png_debug1(3, "allocating unit for info (%d bytes)\n", length); png_debug1(3, "allocating unit for info (%u bytes)\n",
(unsigned int)length);
info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length); info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->scal_s_width == NULL) if (info_ptr->scal_s_width == NULL)
{ {
@@ -493,11 +496,13 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length); png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length);
length = png_strlen(sheight) + 1; length = png_strlen(sheight) + 1;
png_debug1(3, "allocating unit for info (%d bytes)\n", length); png_debug1(3, "allocating unit for info (%u bytes)\n",
(unsigned int)length);
info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, length); info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->scal_s_height == NULL) if (info_ptr->scal_s_height == NULL)
{ {
png_free (png_ptr, info_ptr->scal_s_width); png_free (png_ptr, info_ptr->scal_s_width);
info_ptr->scal_s_width = NULL;
png_warning(png_ptr, png_warning(png_ptr,
"Memory allocation failed while processing sCAL."); "Memory allocation failed while processing sCAL.");
return; return;
@@ -700,7 +705,8 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
if (new_iccp_profile == NULL) if (new_iccp_profile == NULL)
{ {
png_free (png_ptr, new_iccp_name); png_free (png_ptr, new_iccp_name);
png_warning(png_ptr, "Insufficient memory to process iCCP profile."); png_warning(png_ptr,
"Insufficient memory to process iCCP profile.");
return; return;
} }
png_memcpy(new_iccp_profile, profile, (png_size_t)proflen); png_memcpy(new_iccp_profile, profile, (png_size_t)proflen);
@@ -835,11 +841,13 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
} }
textp->key = (png_charp)png_malloc_warn(png_ptr, textp->key = (png_charp)png_malloc_warn(png_ptr,
(png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4)); (png_uint_32)
(key_len + text_length + lang_len + lang_key_len + 4));
if (textp->key == NULL) if (textp->key == NULL)
return(1); return(1);
png_debug2(2, "Allocated %lu bytes at %x in png_set_text\n", png_debug2(2, "Allocated %lu bytes at %x in png_set_text\n",
(png_uint_32)(key_len + lang_len + lang_key_len + text_length + 4), (png_uint_32)
(key_len + lang_len + lang_key_len + text_length + 4),
(int)textp->key); (int)textp->key);
png_memcpy(textp->key, text_ptr[i].key, png_memcpy(textp->key, text_ptr[i].key,
@@ -921,30 +929,45 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
* we do it for backward compatibility with the way the png_handle_tRNS * we do it for backward compatibility with the way the png_handle_tRNS
* function used to do the allocation. * function used to do the allocation.
*/ */
#ifdef PNG_FREE_ME_SUPPORTED #ifdef PNG_FREE_ME_SUPPORTED
png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0); png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
#endif #endif
/* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */ /* 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_ptr->trans = info_ptr->trans = (png_bytep)png_malloc(png_ptr,
(png_uint_32)PNG_MAX_PALETTE_LENGTH); (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); 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) 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_memcpy(&(info_ptr->trans_values), trans_values,
png_sizeof(png_color_16)); png_sizeof(png_color_16));
if (num_trans == 0) if (num_trans == 0)
num_trans = 1; num_trans = 1;
} }
info_ptr->num_trans = (png_uint_16)num_trans; info_ptr->num_trans = (png_uint_16)num_trans;
if (num_trans != 0)
{
info_ptr->valid |= PNG_INFO_tRNS; 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 #endif
@@ -952,6 +975,13 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
void PNGAPI void PNGAPI
png_set_sPLT(png_structp png_ptr, png_set_sPLT(png_structp png_ptr,
png_infop info_ptr, png_sPLT_tp entries, int nentries) png_infop info_ptr, png_sPLT_tp entries, int nentries)
/*
* entries - array of png_sPLT_t structures
* to be added to the list of palettes
* in the info structure.
* nentries - number of palette structures to be
* added.
*/
{ {
png_sPLT_tp np; png_sPLT_tp np;
int i; int i;
@@ -960,7 +990,8 @@ png_set_sPLT(png_structp png_ptr,
return; return;
np = (png_sPLT_tp)png_malloc_warn(png_ptr, np = (png_sPLT_tp)png_malloc_warn(png_ptr,
(info_ptr->splt_palettes_num + nentries) * png_sizeof(png_sPLT_t)); (info_ptr->splt_palettes_num + nentries) *
(png_uint_32)png_sizeof(png_sPLT_t));
if (np == NULL) if (np == NULL)
{ {
png_warning(png_ptr, "No memory for sPLT palettes."); png_warning(png_ptr, "No memory for sPLT palettes.");
@@ -988,7 +1019,7 @@ png_set_sPLT(png_structp png_ptr,
} }
png_memcpy(to->name, from->name, length); png_memcpy(to->name, from->name, length);
to->entries = (png_sPLT_entryp)png_malloc_warn(png_ptr, to->entries = (png_sPLT_entryp)png_malloc_warn(png_ptr,
from->nentries * png_sizeof(png_sPLT_entry)); (png_uint_32)(from->nentries * png_sizeof(png_sPLT_entry)));
if (to->entries == NULL) if (to->entries == NULL)
{ {
png_warning(png_ptr, png_warning(png_ptr,
@@ -1024,8 +1055,8 @@ png_set_unknown_chunks(png_structp png_ptr,
return; return;
np = (png_unknown_chunkp)png_malloc_warn(png_ptr, np = (png_unknown_chunkp)png_malloc_warn(png_ptr,
(info_ptr->unknown_chunks_num + num_unknowns) * (png_uint_32)((info_ptr->unknown_chunks_num + num_unknowns) *
png_sizeof(png_unknown_chunk)); png_sizeof(png_unknown_chunk)));
if (np == NULL) if (np == NULL)
{ {
png_warning(png_ptr, png_warning(png_ptr,
@@ -1047,20 +1078,24 @@ png_set_unknown_chunks(png_structp png_ptr,
(png_charp)from->name, (png_charp)from->name,
png_sizeof(from->name)); png_sizeof(from->name));
to->name[png_sizeof(to->name)-1] = '\0'; 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);
to->data = (png_bytep)png_malloc_warn(png_ptr, from->size); if (from->size == 0)
to->data=NULL;
else
{
to->data = (png_bytep)png_malloc_warn(png_ptr,
(png_uint_32)from->size);
if (to->data == NULL) if (to->data == NULL)
{ {
png_warning(png_ptr, png_warning(png_ptr,
"Out of memory while processing unknown chunk."); "Out of memory while processing unknown chunk.");
to->size = 0;
} }
else else
{
png_memcpy(to->data, from->data, from->size); 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);
} }
} }
@@ -1137,7 +1172,8 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
return; return;
old_num_chunks=png_ptr->num_chunk_list; old_num_chunks=png_ptr->num_chunk_list;
new_list=(png_bytep)png_malloc(png_ptr, new_list=(png_bytep)png_malloc(png_ptr,
(png_uint_32)(5*(num_chunks+old_num_chunks))); (png_uint_32)
(5*(num_chunks + old_num_chunks)));
if(png_ptr->chunk_list != NULL) if(png_ptr->chunk_list != NULL)
{ {
png_memcpy(new_list, png_ptr->chunk_list, png_memcpy(new_list, png_ptr->chunk_list,
@@ -1189,11 +1225,11 @@ png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
void PNGAPI void PNGAPI
png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size) png_set_compression_buffer_size(png_structp png_ptr,
png_uint_32 size)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return; 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_size = (png_size_t)size;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size); png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size);
@@ -1219,6 +1255,7 @@ png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags)
/* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */ /* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */
if (png_ptr != NULL) if (png_ptr != NULL)
png_ptr->asm_flags = 0; png_ptr->asm_flags = 0;
asm_flags = asm_flags; /* Quiet the compiler */
} }
/* this function was added to libpng 1.2.0 */ /* this function was added to libpng 1.2.0 */
@@ -1230,6 +1267,9 @@ png_set_mmx_thresholds (png_structp png_ptr,
/* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */ /* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
/* Quiet the compiler */
mmx_bitdepth_threshold = mmx_bitdepth_threshold;
mmx_rowbytes_threshold = mmx_rowbytes_threshold;
} }
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
+3 -3
View File
@@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers) /* pngtrans.c - transforms the data in a row (used by both readers and writers)
* *
* Last changed in libpng 1.2.17 May 15, 2007 * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -10,8 +10,8 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
/* turn on BGR-to-RGB mapping */ /* turn on BGR-to-RGB mapping */
void PNGAPI void PNGAPI
@@ -652,8 +652,8 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
png_voidp PNGAPI png_voidp PNGAPI
png_get_user_transform_ptr(png_structp png_ptr) png_get_user_transform_ptr(png_structp png_ptr)
{ {
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
if (png_ptr == NULL) return (NULL); if (png_ptr == NULL) return (NULL);
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
return ((png_voidp)png_ptr->user_transform_ptr); return ((png_voidp)png_ptr->user_transform_ptr);
#else #else
return (NULL); return (NULL);
+1 -1
View File
@@ -1,7 +1,7 @@
/* pngwio.c - functions for data output /* pngwio.c - functions for data output
* *
* Last changed in libpng 1.2.13 November 13, 2006 * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+19 -2
View File
@@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file /* 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.31 [August 19, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (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 || ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) (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); png_write_chunk(png_ptr, up->name, up->data, up->size);
} }
} }
@@ -391,6 +393,18 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
/* write end of PNG file */ /* write end of PNG file */
png_write_IEND(png_ptr); png_write_IEND(png_ptr);
/* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03,
* and restored again in libpng-1.2.30, may cause some applications that
* do not set png_ptr->output_flush_fn to crash. If your application
* experiences a problem, please try building libpng with
* PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED defined, and report the event to
* png-mng-implement at lists.sf.net . This kludge will be removed
* from libpng-1.4.0.
*/
#if defined(PNG_WRITE_FLUSH_SUPPORTED) && \
defined(PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED)
png_flush(png_ptr);
#endif
} }
#if defined(PNG_WRITE_tIME_SUPPORTED) #if defined(PNG_WRITE_tIME_SUPPORTED)
@@ -437,6 +451,9 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn) png_malloc_ptr malloc_fn, png_free_ptr free_fn)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
#ifdef PNG_SETJMP_SUPPORTED
volatile
#endif
png_structp png_ptr; png_structp png_ptr;
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD #ifdef USE_FAR_KEYWORD
@@ -1074,7 +1091,7 @@ png_write_destroy(png_structp png_ptr)
/* free our memory. png_free checks NULL for us. */ /* free our memory. png_free checks NULL for us. */
png_free(png_ptr, png_ptr->zbuf); png_free(png_ptr, png_ptr->zbuf);
png_free(png_ptr, png_ptr->row_buf); png_free(png_ptr, png_ptr->row_buf);
#ifndef PNG_NO_WRITE_FILTERING #ifndef PNG_NO_WRITE_FILTER
png_free(png_ptr, png_ptr->prev_row); png_free(png_ptr, png_ptr->prev_row);
png_free(png_ptr, png_ptr->sub_row); png_free(png_ptr, png_ptr->sub_row);
png_free(png_ptr, png_ptr->up_row); png_free(png_ptr, png_ptr->up_row);
+1 -1
View File
@@ -3,7 +3,7 @@
* *
* Last changed in libpng 1.2.9 April 14, 2006 * Last changed in libpng 1.2.9 April 14, 2006
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2006 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/ */
+131 -96
View File
File diff suppressed because it is too large Load Diff