From 85f7d0a8d5f45176d8f200e59b0d3002ff0f445d Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 21 Mar 2009 08:10:28 -0500 Subject: [PATCH] Imported from libpng-1.2.36beta02.tar --- ANNOUNCE | 43 ++++++---- CHANGES | 9 +++ INSTALL | 16 ++-- KNOWNBUG | 2 +- LICENSE | 4 +- Makefile.am | 2 +- Makefile.in | 2 +- README | 14 ++-- Y2KINFO | 4 +- configure | 22 +++--- configure.ac | 4 +- contrib/pngminim/encoder/pngusr.h | 1 + example.c | 2 +- ....2.36beta01.txt => libpng-1.2.36beta02.txt | 66 +++++++++++----- libpng.3 | 78 +++++++++++++------ libpngpf.3 | 4 +- png.5 | 2 +- png.c | 5 +- png.h | 25 +++--- pngconf.h | 10 +-- pngerror.c | 36 ++++++--- pngmem.c | 1 + pngread.c | 4 +- pngrio.c | 2 +- pngrtran.c | 7 +- pngrutil.c | 12 +-- pngset.c | 8 +- pngtest.c | 14 ++-- pngwio.c | 10 ++- pngwutil.c | 4 +- scripts/CMakeLists.txt | 2 +- scripts/libpng-config-head.in | 2 +- scripts/libpng.pc.in | 2 +- scripts/makefile.32sunu | 2 +- scripts/makefile.64sunu | 2 +- scripts/makefile.aix | 2 +- scripts/makefile.beos | 2 +- scripts/makefile.cygwin | 2 +- scripts/makefile.darwin | 2 +- scripts/makefile.dec | 2 +- scripts/makefile.elf | 2 +- scripts/makefile.gcmmx | 2 +- scripts/makefile.hp64 | 2 +- scripts/makefile.hpgcc | 2 +- scripts/makefile.hpux | 2 +- scripts/makefile.linux | 2 +- scripts/makefile.mingw | 2 +- scripts/makefile.ne12bsd | 2 +- scripts/makefile.netbsd | 2 +- scripts/makefile.nommx | 2 +- scripts/makefile.openbsd | 2 +- scripts/makefile.sco | 2 +- scripts/makefile.sggcc | 2 +- scripts/makefile.sgi | 2 +- scripts/makefile.so9 | 2 +- scripts/makefile.solaris | 2 +- scripts/makefile.solaris-x86 | 2 +- scripts/pngos2.def | 2 +- scripts/pngw32.def | 2 +- 59 files changed, 278 insertions(+), 193 deletions(-) rename libpng-1.2.36beta01.txt => libpng-1.2.36beta02.txt (98%) diff --git a/ANNOUNCE b/ANNOUNCE index 3eac7e98..87bf52a2 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.2.36beta01 - February 28, 2009 +Libpng 1.2.36beta02 - March 21, 2009 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -9,37 +9,37 @@ Files available for download: Source files with LF line endings (for Unix/Linux) and with a "configure" script - libpng-1.2.36beta01.tar.gz - libpng-1.2.36beta01.tar.lzma + libpng-1.2.36beta02.tar.gz + libpng-1.2.36beta02.tar.lzma (Get the lzma codec from ). - libpng-1.2.36beta01.tar.bz2 + libpng-1.2.36beta02.tar.bz2 Source files with LF line endings (for Unix/Linux) without the "configure" script - libpng-1.2.36beta01-no-config.tar.gz - libpng-1.2.36beta01-no-config.tar.lzma - libpng-1.2.36beta01-no-config.tar.bz2 + libpng-1.2.36beta02-no-config.tar.gz + libpng-1.2.36beta02-no-config.tar.lzma + libpng-1.2.36beta02-no-config.tar.bz2 Source files with CRLF line endings (for Windows), without the "configure" script - lp1236b01.zip - lp1236b01.7z - lp1236b01.tar.bz2 + lp1236b02.zip + lp1236b02.7z + lp1236b02.tar.bz2 Project files - libpng-1.2.36beta01-project-netware.zip - libpng-1.2.36beta01-project-wince.zip + libpng-1.2.36beta02-project-netware.zip + libpng-1.2.36beta02-project-wince.zip Other information: - libpng-1.2.36beta01-README.txt - libpng-1.2.36beta01-KNOWNBUGS.txt - libpng-1.2.36beta01-LICENSE.txt - libpng-1.2.36beta01-Y2K-compliance.txt - libpng-1.2.36beta01-[previous version]-diff.txt + libpng-1.2.36beta02-README.txt + libpng-1.2.36beta02-KNOWNBUGS.txt + libpng-1.2.36beta02-LICENSE.txt + libpng-1.2.36beta02-Y2K-compliance.txt + libpng-1.2.36beta02-[previous version]-diff.txt Changes since the last public release (1.2.34): @@ -67,6 +67,15 @@ version 1.2.36beta01 [February 28, 2009] Revised order of #ifdef's and indentation in png_debug definitions of png.h bug introduced in libpng-1.2.34. +version 1.2.36beta02 [March 21, 2009] + Use png_memset() after png_malloc() of big_row_buf when reading an + interlaced file, to avoid a possible UMR. + Undid recent revision of PNG_NO_STDIO version of png_write_flush(). Users + having trouble with fflush() can build with PNG_NO_WRITE_FLUSH defined. + Revised libpng*.txt documentation about use of png_write_flush(). + Removed fflush() from pngtest.c. + Added "#define PNG_NO_WRITE_FLUSH" to contrib/pngminim/encoder/pngusr.h + Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 4db3cc11..a1b6861b 100644 --- a/CHANGES +++ b/CHANGES @@ -2334,6 +2334,15 @@ version 1.2.36beta01 [February 28, 2009] Revised order of #ifdef's and indentation in png_debug definitions of png.h bug introduced in libpng-1.2.34. +version 1.2.36beta02 [March 21, 2009] + Use png_memset() after png_malloc() of big_row_buf when reading an + interlaced file, to avoid a possible UMR. + Undid recent revision of PNG_NO_STDIO version of png_write_flush(). Users + having trouble with fflush() can build with PNG_NO_WRITE_FLUSH defined. + Revised libpng*.txt documentation about use of png_write_flush(). + Removed fflush() from pngtest.c. + Added "#define PNG_NO_WRITE_FLUSH" to contrib/pngminim/encoder/pngusr.h + Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement diff --git a/INSTALL b/INSTALL index cd90b480..2c79cebd 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ -Installing libpng version 1.2.36beta01 - February 28, 2009 +Installing libpng version 1.2.36beta02 - March 21, 2009 On Unix/Linux and similar systems, you can simply type @@ -44,7 +44,7 @@ to have access to the zlib.h and zconf.h include files that correspond to the version of zlib that's installed. You can rename the directories that you downloaded (they -might be called "libpng-1.2.36beta01" or "lpng109" and "zlib-1.2.1" +might be called "libpng-1.2.36beta02" or "lpng109" and "zlib-1.2.1" or "zlib121") so that you have directories called "zlib" and "libpng". Your directory structure should look like this: @@ -101,9 +101,9 @@ include CMakeLists.txt => "cmake" script makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.elf => Linux/ELF makefile symbol versioning, - gcc, creates libpng12.so.0.1.2.36beta01) + gcc, creates libpng12.so.0.1.2.36beta02) makefile.linux => Linux/ELF makefile - (gcc, creates libpng12.so.0.1.2.36beta01) + (gcc, creates libpng12.so.0.1.2.36beta02) makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.knr => Archaic UNIX Makefile that converts files with ansi2knr (Requires ansi2knr.c from @@ -125,14 +125,14 @@ include makefile.openbsd => OpenBSD makefile makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) makefile.sggcc => Silicon Graphics (gcc, - creates libpng12.so.0.1.2.36beta01) + creates libpng12.so.0.1.2.36beta02) makefile.sunos => Sun makefile makefile.solaris => Solaris 2.X makefile (gcc, - creates libpng12.so.0.1.2.36beta01) + creates libpng12.so.0.1.2.36beta02) makefile.solaris-x86 => Solaris/intelMMX 2.X makefile (gcc, - creates libpng12.so.0.1.2.36beta01) + creates libpng12.so.0.1.2.36beta02) makefile.so9 => Solaris 9 makefile (gcc, - creates libpng12.so.0.1.2.36beta01) + creates libpng12.so.0.1.2.36beta02) makefile.32sunu => Sun Ultra 32-bit makefile makefile.64sunu => Sun Ultra 64-bit makefile makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc diff --git a/KNOWNBUG b/KNOWNBUG index 10261ff4..5621b583 100644 --- a/KNOWNBUG +++ b/KNOWNBUG @@ -1,5 +1,5 @@ -Known bugs in libpng version 1.2.36beta01 +Known bugs in libpng version 1.2.36beta02 1. February 23, 2006: The custom makefiles don't build libpng with -lz. diff --git a/LICENSE b/LICENSE index 7ac0091c..f6af8d58 100644 --- a/LICENSE +++ b/LICENSE @@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: If you modify libpng you may insert additional notices immediately following this sentence. -libpng versions 1.2.6, August 15, 2004, through 1.2.36beta01, February 28, 2009, are +libpng versions 1.2.6, August 15, 2004, through 1.2.36beta02, March 21, 2009, are Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.2.5 with the following individual added to the list of Contributing Authors @@ -106,4 +106,4 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson glennrp at users.sourceforge.net -February 28, 2009 +March 21, 2009 diff --git a/Makefile.am b/Makefile.am index fd1aca4b..92202fca 100644 --- a/Makefile.am +++ b/Makefile.am @@ -86,7 +86,7 @@ EXTRA_DIST= \ ${srcdir}/contrib/pngsuite/* \ ${srcdir}/contrib/visupng/* \ $(TESTS) \ - example.c libpng-1.2.36beta01.txt pngvcrd.c + example.c libpng-1.2.36beta02.txt pngvcrd.c CLEANFILES= pngout.png libpng12.pc libpng12-config libpng.vers \ libpng.sym diff --git a/Makefile.in b/Makefile.in index 6bc77d16..81072f9e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -331,7 +331,7 @@ EXTRA_DIST = \ ${srcdir}/contrib/pngsuite/* \ ${srcdir}/contrib/visupng/* \ $(TESTS) \ - example.c libpng-1.2.36beta01.txt pngvcrd.c + example.c libpng-1.2.36beta02.txt pngvcrd.c CLEANFILES = pngout.png libpng12.pc libpng12-config libpng.vers \ libpng.sym diff --git a/README b/README index b6d31d90..a2e87325 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -README for libpng version 1.2.36beta01 - February 28, 2009 (shared library 12.0) +README for libpng version 1.2.36beta02 - March 21, 2009 (shared library 12.0) See the note about version numbers near the top of png.h See INSTALL for instructions on how to install libpng. @@ -194,11 +194,11 @@ Files in this distribution: descrip.mms => VMS makefile for MMS or MMK makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.elf => Linux/ELF makefile symbol versioning, - gcc, creates libpng12.so.0.1.2.36beta01) + gcc, creates libpng12.so.0.1.2.36beta02) makefile.linux => Linux/ELF makefile - (gcc, creates libpng12.so.0.1.2.36beta01) + (gcc, creates libpng12.so.0.1.2.36beta02) makefile.gcmmx => Linux/ELF makefile - (gcc, creates libpng12.so.0.1.2.36beta01, + (gcc, creates libpng12.so.0.1.2.36beta02, uses assembler code tuned for Intel MMX platform) makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.knr => Archaic UNIX Makefile that converts files with @@ -220,12 +220,12 @@ Files in this distribution: makefile.openbsd => OpenBSD makefile makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) makefile.sggcc => Silicon Graphics - (gcc, creates libpng12.so.0.1.2.36beta01) + (gcc, creates libpng12.so.0.1.2.36beta02) makefile.sunos => Sun makefile makefile.solaris => Solaris 2.X makefile - (gcc, creates libpng12.so.0.1.2.36beta01) + (gcc, creates libpng12.so.0.1.2.36beta02) makefile.so9 => Solaris 9 makefile - (gcc, creates libpng12.so.0.1.2.36beta01) + (gcc, creates libpng12.so.0.1.2.36beta02) makefile.32sunu => Sun Ultra 32-bit makefile makefile.64sunu => Sun Ultra 64-bit makefile makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc diff --git a/Y2KINFO b/Y2KINFO index 5bc667a0..bfb7506d 100644 --- a/Y2KINFO +++ b/Y2KINFO @@ -1,13 +1,13 @@ Y2K compliance in libpng: ========================= - February 28, 2009 + March 21, 2009 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and - upward through 1.2.36beta01 are Y2K compliant. It is my belief that earlier + upward through 1.2.36beta02 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has three year fields. One is a 2-byte unsigned integer diff --git a/configure b/configure index ea04ca8c..6224d0c2 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.62 for libpng 1.2.36beta01. +# Generated by GNU Autoconf 2.62 for libpng 1.2.36beta02. # # Report bugs to . # @@ -745,8 +745,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='libpng' PACKAGE_TARNAME='libpng' -PACKAGE_VERSION='1.2.36beta01' -PACKAGE_STRING='libpng 1.2.36beta01' +PACKAGE_VERSION='1.2.36beta02' +PACKAGE_STRING='libpng 1.2.36beta02' PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net' ac_unique_file="pngget.c" @@ -1484,7 +1484,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libpng 1.2.36beta01 to adapt to many kinds of systems. +\`configure' configures libpng 1.2.36beta02 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1554,7 +1554,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libpng 1.2.36beta01:";; + short | recursive ) echo "Configuration of libpng 1.2.36beta02:";; esac cat <<\_ACEOF @@ -1661,7 +1661,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libpng configure 1.2.36beta01 +libpng configure 1.2.36beta02 generated by GNU Autoconf 2.62 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1675,7 +1675,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libpng $as_me 1.2.36beta01, which was +It was created by libpng $as_me 1.2.36beta02, which was generated by GNU Autoconf 2.62. Invocation command line was $ $0 $@ @@ -2389,7 +2389,7 @@ fi # Define the identity of the package. PACKAGE='libpng' - VERSION='1.2.36beta01' + VERSION='1.2.36beta02' cat >>confdefs.h <<_ACEOF @@ -2558,7 +2558,7 @@ fi -PNGLIB_VERSION=1.2.36beta01 +PNGLIB_VERSION=1.2.36beta02 PNGLIB_MAJOR=1 PNGLIB_MINOR=2 PNGLIB_RELEASE=36 @@ -13125,7 +13125,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libpng $as_me 1.2.36beta01, which was +This file was extended by libpng $as_me 1.2.36beta02, which was generated by GNU Autoconf 2.62. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13178,7 +13178,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -libpng config.status 1.2.36beta01 +libpng config.status 1.2.36beta02 configured by $0, generated by GNU Autoconf 2.62, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index f8bf7833..4c7c4401 100644 --- a/configure.ac +++ b/configure.ac @@ -18,12 +18,12 @@ AC_PREREQ(2.59) dnl Version number stuff here: -AC_INIT([libpng], [1.2.36beta01], [png-mng-implement@lists.sourceforge.net]) +AC_INIT([libpng], [1.2.36beta02], [png-mng-implement@lists.sourceforge.net]) AM_INIT_AUTOMAKE dnl stop configure from automagically running automake AM_MAINTAINER_MODE -PNGLIB_VERSION=1.2.36beta01 +PNGLIB_VERSION=1.2.36beta02 PNGLIB_MAJOR=1 PNGLIB_MINOR=2 PNGLIB_RELEASE=36 diff --git a/contrib/pngminim/encoder/pngusr.h b/contrib/pngminim/encoder/pngusr.h index 904673ab..18989d12 100644 --- a/contrib/pngminim/encoder/pngusr.h +++ b/contrib/pngminim/encoder/pngusr.h @@ -51,6 +51,7 @@ #define PNG_NO_WRITE_FILTER #define PNG_NO_WRITE_WEIGHTED_FILTER #define PNG_NO_WRITE_INTERLACING_SUPPORTED +#define PNG_NO_WRITE_FLUSH #define PNG_NO_INFO_IMAGE #define PNG_NO_USER_MEM diff --git a/example.c b/example.c index 48b24ddf..d8c2f48f 100644 --- a/example.c +++ b/example.c @@ -2,7 +2,7 @@ #if 0 /* in case someone actually tries to compile this */ /* example.c - an example of using libpng - * Last changed in libpng 1.2.35 [February 14, 2009] + * Last changed in libpng 1.2.36 [March 21, 2009] * This file has been placed in the public domain by the authors. * Maintained 1998-2009 Glenn Randers-Pehrson * Maintained 1996, 1997 Andreas Dilger) diff --git a/libpng-1.2.36beta01.txt b/libpng-1.2.36beta02.txt similarity index 98% rename from libpng-1.2.36beta01.txt rename to libpng-1.2.36beta02.txt index b853b112..056c74fb 100644 --- a/libpng-1.2.36beta01.txt +++ b/libpng-1.2.36beta02.txt @@ -1,6 +1,6 @@ libpng.txt - A description on how to use and modify libpng - libpng version 1.2.36beta01 - February 28, 2009 + libpng version 1.2.36beta02 - March 21, 2009 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson @@ -9,7 +9,7 @@ libpng.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.2.36beta01 - February 28, 2009 + libpng versions 0.97, January 1998, through 1.2.36beta02 - March 21, 2009 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2008 Glenn Randers-Pehrson @@ -407,6 +407,27 @@ callback function: (int)sizeof(unused_chunks)/5); #endif +User limits + +The PNG specification allows the width and height of an image to be as +large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns. +Since very few applications really need to process such large images, +we have imposed an arbitrary 1-million limit on rows and columns. +Larger images will be rejected immediately with a png_error() call. If +you wish to override this limit, you can use + + png_set_user_limits(png_ptr, width_max, height_max); + +to set your own limits, or use width_max = height_max = 0x7fffffffL +to allow all valid dimensions (libpng may reject some very large images +anyway because of potential buffer overflow conditions). + +You should put this statement after you create the PNG structure and +before calling png_read_info(), png_read_png(), or png_process_data(). +If you need to retrieve the limits that are being applied, use + + width_max = png_get_user_width_max(png_ptr); + height_max = png_get_user_height_max(png_ptr); The high-level read interface @@ -850,9 +871,6 @@ things. As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was added. It expands the sample depth without changing tRNS to alpha. -At the same time, png_set_gray_1_2_4_to_8() was deprecated, and it -will be removed from a future version. - PNG can have files with 16 bits per channel. If you only can handle 8 bits per channel, this will strip the pixels down to 8 bit. @@ -2069,7 +2087,12 @@ transformations are permitted, enabled by the following masks. PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity to transparency PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples - PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes. + PNG_TRANSFORM_STRIP_FILLER Strip out filler + bytes (deprecated). + PNG_TRANSFORM_STRIP_FILLER_BEFORE Strip out leading + filler bytes + PNG_TRANSFORM_STRIP_FILLER_AFTER Strip out trailing + filler bytes If you have valid image data in the info structure (you can use png_set_rows() to put image data in the info structure), simply do this: @@ -2476,9 +2499,15 @@ The replacement I/O functions must have prototypes as follows: png_bytep data, png_size_t length); void user_flush_data(png_structp png_ptr); +The user_read_data() function is responsible for detecting and +handling end-of-data errors. + Supplying NULL for the read, write, or flush functions sets them back -to using the default C stream functions. It is an error to read from -a write stream, and vice versa. +to using the default C stream functions, which expect the io_ptr to +point to a standard *FILE structure. It is probably a mistake +to use NULL for one of write_data_fn and output_flush_fn but not both +of them, unless you have built libpng with PNG_NO_WRITE_FLUSH defined. +It is an error to read from a write stream, and vice versa. Error handling in libpng is done through png_error() and png_warning(). Errors handled through png_error() are fatal, meaning that png_error() @@ -2583,11 +2612,12 @@ you may also have to change the memory allocators (png_malloc, etc.). Configuring for compiler xxx: -All includes for libpng are in pngconf.h. If you need to add/change/delete -an include, this is the place to do it. The includes that are not -needed outside libpng are protected by the PNG_INTERNAL definition, -which is only defined for those routines inside libpng itself. The -files in libpng proper only include png.h, which includes pngconf.h. +All includes for libpng are in pngconf.h. If you need to add, change +or delete an include, this is the place to do it. +The includes that are not needed outside libpng are protected by the +PNG_INTERNAL definition, which is only defined for those routines inside +libpng itself. The files in libpng proper only include png.h, which +includes pngconf.h. Configuring zlib: @@ -2778,7 +2808,7 @@ When PNG_DEBUG = 1, the macros are defined, but only png_debug statements having level = 0 will be printed. There aren't any such statements in this version of libpng, but if you insert some they will be printed. -VII. MNG support +VI. MNG support The MNG specification (available at http://www.libpng.org/pub/mng) allows certain extensions to PNG for PNG images that are embedded in MNG datastreams. @@ -2803,7 +2833,7 @@ or any other MNG chunks; your application must provide its own support for them. You may wish to consider using libmng (available at http://www.libmng.com) instead. -VIII. Changes to Libpng from version 0.88 +VII. Changes to Libpng from version 0.88 It should be noted that versions of libpng later than 0.96 are not distributed by the original libpng author, Guy Schalnat, nor by @@ -2852,15 +2882,15 @@ application: png_uint_32 application_vn = PNG_LIBPNG_VER; -IX. Y2K Compliance in libpng +VIII. Y2K Compliance in libpng -February 28, 2009 +March 21, 2009 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.2.36beta01 are Y2K compliant. It is my belief that earlier +upward through 1.2.36beta02 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has three year fields. One is a 2-byte unsigned integer that diff --git a/libpng.3 b/libpng.3 index a32a31ff..9141d04d 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,6 +1,6 @@ -.TH LIBPNG 3 "February 28, 2009" +.TH LIBPNG 3 "March 21, 2009" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.2.36beta01 +libpng \- Portable Network Graphics (PNG) Reference Library 1.2.36beta02 .SH SYNOPSIS \fI\fB @@ -821,7 +821,7 @@ Following is a copy of the libpng.txt file that accompanies libpng. .SH LIBPNG.TXT libpng.txt - A description on how to use and modify libpng - libpng version 1.2.36beta01 - February 28, 2009 + libpng version 1.2.36beta02 - March 21, 2009 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson @@ -830,7 +830,7 @@ libpng.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.2.36beta01 - February 28, 2009 + libpng versions 0.97, January 1998, through 1.2.36beta02 - March 21, 2009 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2008 Glenn Randers-Pehrson @@ -1228,6 +1228,27 @@ callback function: (int)sizeof(unused_chunks)/5); #endif +.SS User limits + +The PNG specification allows the width and height of an image to be as +large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns. +Since very few applications really need to process such large images, +we have imposed an arbitrary 1-million limit on rows and columns. +Larger images will be rejected immediately with a png_error() call. If +you wish to override this limit, you can use + + png_set_user_limits(png_ptr, width_max, height_max); + +to set your own limits, or use width_max = height_max = 0x7fffffffL +to allow all valid dimensions (libpng may reject some very large images +anyway because of potential buffer overflow conditions). + +You should put this statement after you create the PNG structure and +before calling png_read_info(), png_read_png(), or png_process_data(). +If you need to retrieve the limits that are being applied, use + + width_max = png_get_user_width_max(png_ptr); + height_max = png_get_user_height_max(png_ptr); .SS The high-level read interface @@ -1671,9 +1692,6 @@ things. As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was added. It expands the sample depth without changing tRNS to alpha. -At the same time, png_set_gray_1_2_4_to_8() was deprecated, and it -will be removed from a future version. - PNG can have files with 16 bits per channel. If you only can handle 8 bits per channel, this will strip the pixels down to 8 bit. @@ -2890,7 +2908,12 @@ transformations are permitted, enabled by the following masks. PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity to transparency PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples - PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes. + PNG_TRANSFORM_STRIP_FILLER Strip out filler + bytes (deprecated). + PNG_TRANSFORM_STRIP_FILLER_BEFORE Strip out leading + filler bytes + PNG_TRANSFORM_STRIP_FILLER_AFTER Strip out trailing + filler bytes If you have valid image data in the info structure (you can use png_set_rows() to put image data in the info structure), simply do this: @@ -3297,9 +3320,15 @@ The replacement I/O functions must have prototypes as follows: png_bytep data, png_size_t length); void user_flush_data(png_structp png_ptr); +The user_read_data() function is responsible for detecting and +handling end-of-data errors. + Supplying NULL for the read, write, or flush functions sets them back -to using the default C stream functions. It is an error to read from -a write stream, and vice versa. +to using the default C stream functions, which expect the io_ptr to +point to a standard *FILE structure. It is probably a mistake +to use NULL for one of write_data_fn and output_flush_fn but not both +of them, unless you have built libpng with PNG_NO_WRITE_FLUSH defined. +It is an error to read from a write stream, and vice versa. Error handling in libpng is done through png_error() and png_warning(). Errors handled through png_error() are fatal, meaning that png_error() @@ -3404,11 +3433,12 @@ you may also have to change the memory allocators (png_malloc, etc.). .SS Configuring for compiler xxx: -All includes for libpng are in pngconf.h. If you need to add/change/delete -an include, this is the place to do it. The includes that are not -needed outside libpng are protected by the PNG_INTERNAL definition, -which is only defined for those routines inside libpng itself. The -files in libpng proper only include png.h, which includes pngconf.h. +All includes for libpng are in pngconf.h. If you need to add, change +or delete an include, this is the place to do it. +The includes that are not needed outside libpng are protected by the +PNG_INTERNAL definition, which is only defined for those routines inside +libpng itself. The files in libpng proper only include png.h, which +includes pngconf.h. .SS Configuring zlib: @@ -3599,7 +3629,7 @@ When PNG_DEBUG = 1, the macros are defined, but only png_debug statements having level = 0 will be printed. There aren't any such statements in this version of libpng, but if you insert some they will be printed. -.SH VII. MNG support +.SH VI. MNG support The MNG specification (available at http://www.libpng.org/pub/mng) allows certain extensions to PNG for PNG images that are embedded in MNG datastreams. @@ -3624,7 +3654,7 @@ or any other MNG chunks; your application must provide its own support for them. You may wish to consider using libmng (available at http://www.libmng.com) instead. -.SH VIII. Changes to Libpng from version 0.88 +.SH VII. Changes to Libpng from version 0.88 It should be noted that versions of libpng later than 0.96 are not distributed by the original libpng author, Guy Schalnat, nor by @@ -3673,15 +3703,15 @@ application: png_uint_32 application_vn = PNG_LIBPNG_VER; -.SH IX. Y2K Compliance in libpng +.SH VIII. Y2K Compliance in libpng -February 28, 2009 +March 21, 2009 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.2.36beta01 are Y2K compliant. It is my belief that earlier +upward through 1.2.36beta02 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has three year fields. One is a 2-byte unsigned integer that @@ -3943,7 +3973,7 @@ the first widely used release: 1.2.35rc01-02 13 10235 12.so.0.35[.0] 1.0.43 10 10043 10.so.0.43[.0] 1.2.35 13 10235 12.so.0.35[.0] - 1.2.36beta01 13 10236 12.so.0.36[.0] + 1.2.36beta01-02 13 10236 12.so.0.36[.0] Henceforth the source version will match the shared-library minor and patch numbers; the shared-library major version number will be @@ -3999,7 +4029,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.2.36beta01 - February 28, 2009: +Libpng version 1.2.36beta02 - March 21, 2009: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). @@ -4020,7 +4050,7 @@ included in the libpng distribution, the latter shall prevail.) If you modify libpng you may insert additional notices immediately following this sentence. -libpng versions 1.2.6, August 15, 2004, through 1.2.36beta01, February 28, 2009, are +libpng versions 1.2.6, August 15, 2004, through 1.2.36beta02, March 21, 2009, are Copyright (c) 2004,2006-2008 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.2.5 with the following individual added to the list of Contributing Authors @@ -4119,7 +4149,7 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson glennrp at users.sourceforge.net -February 28, 2009 +March 21, 2009 .\" end of man page diff --git a/libpngpf.3 b/libpngpf.3 index 04daa14c..281fd017 100644 --- a/libpngpf.3 +++ b/libpngpf.3 @@ -1,6 +1,6 @@ -.TH LIBPNGPF 3 "February 28, 2009" +.TH LIBPNGPF 3 "March 21, 2009" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.2.36beta01 +libpng \- Portable Network Graphics (PNG) Reference Library 1.2.36beta02 (private functions) .SH SYNOPSIS \fB#include \fP diff --git a/png.5 b/png.5 index 1a4b4b52..00e2a48d 100644 --- a/png.5 +++ b/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "February 28, 2009" +.TH PNG 5 "March 21, 2009" .SH NAME png \- Portable Network Graphics (PNG) format .SH DESCRIPTION diff --git a/png.c b/png.c index aa50988a..3392cf73 100644 --- a/png.c +++ b/png.c @@ -13,7 +13,7 @@ #include "png.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_2_36beta01 Your_png_h_is_not_version_1_2_36beta01; +typedef version_1_2_36beta02 Your_png_h_is_not_version_1_2_36beta02; /* Version information for C files. This had better match the version * string defined in png.h. */ @@ -694,7 +694,7 @@ png_charp PNGAPI png_get_copyright(png_structp png_ptr) { png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */ - return ((png_charp) "\n libpng version 1.2.36beta01 - February 28, 2009\n\ + return ((png_charp) "\n libpng version 1.2.36beta02 - March 21, 2009\n\ Copyright (c) 1998-2008 Glenn Randers-Pehrson\n\ Copyright (c) 1996-1997 Andreas Dilger\n\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n"); @@ -800,6 +800,7 @@ png_convert_size(size_t size) /* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */ #if defined(PNG_cHRM_SUPPORTED) #if !defined(PNG_NO_CHECK_cHRM) + /* Multiply two 32-bit numbers, V1 and V2, using 32-bit arithmetic, to produce a 64 bit result in the HI/LO words. diff --git a/png.h b/png.h index c1bb920c..53fa6f07 100644 --- a/png.h +++ b/png.h @@ -1,6 +1,6 @@ /* png.h - header file for PNG reference library * - * libpng version 1.2.36beta01 - February 28, 2009 + * libpng version 1.2.36beta02 - March 21, 2009 * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -8,7 +8,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.2.36beta01 - February 28, 2009: Glenn + * libpng versions 0.97, January 1998, through 1.2.36beta02 - March 21, 2009: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -222,7 +222,7 @@ * 1.2.35rc01-02 13 10235 12.so.0.35[.0] * 1.0.43 10 10043 10.so.0.43[.0] * 1.2.35 13 10235 12.so.0.35[.0] - * 1.2.36beta01 13 10236 12.so.0.36[.0] + * 1.2.36beta01-02 13 10236 12.so.0.36[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -252,7 +252,7 @@ * If you modify libpng you may insert additional notices immediately following * this sentence. * - * libpng versions 1.2.6, August 15, 2004, through 1.2.36beta01, February 28, 2009, are + * libpng versions 1.2.6, August 15, 2004, through 1.2.36beta02, March 21, 2009, are * Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: @@ -364,13 +364,13 @@ * Y2K compliance in libpng: * ========================= * - * February 28, 2009 + * March 21, 2009 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.2.36beta01 are Y2K compliant. It is my belief that earlier + * upward through 1.2.36beta02 are Y2K compliant. It is my belief that earlier * versions were also Y2K compliant. * * Libpng only has three year fields. One is a 2-byte unsigned integer @@ -426,9 +426,9 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.2.36beta01" +#define PNG_LIBPNG_VER_STRING "1.2.36beta02" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.2.36beta01 - February 28, 2009\n" + " libpng version 1.2.36beta02 - March 21, 2009\n" #define PNG_LIBPNG_VER_SONUM 0 #define PNG_LIBPNG_VER_DLLNUM 13 @@ -440,7 +440,7 @@ /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ -#define PNG_LIBPNG_VER_BUILD 01 +#define PNG_LIBPNG_VER_BUILD 02 /* Release Status */ #define PNG_LIBPNG_BUILD_ALPHA 1 @@ -1488,7 +1488,7 @@ struct png_struct_def /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef png_structp version_1_2_36beta01; +typedef png_structp version_1_2_36beta02; typedef png_struct FAR * FAR * png_structpp; @@ -1988,6 +1988,11 @@ extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr)); * If buffered output is not used, then output_flush_fn can be set to NULL. * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time * output_flush_fn will be ignored (and thus can be NULL). + * It is probably a mistake to use NULL for output_flush_fn if + * write_data_fn is not also NULL unless you have built libpng with + * PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's + * default flush function, which uses the standard *FILE structure, will + * be used. */ extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); diff --git a/pngconf.h b/pngconf.h index 2bb5daba..ab152b4d 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.2.36beta01 - February 28, 2009 + * libpng version 1.2.36beta02 - March 21, 2009 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -800,7 +800,6 @@ # define PNG_USER_HEIGHT_MAX 1000000L #endif - /* Added at libpng-1.2.34 and 1.4.0 */ #ifndef PNG_STRING_NEWLINE #define PNG_STRING_NEWLINE "\n" @@ -1439,7 +1438,6 @@ typedef z_stream FAR * png_zstreamp; # define NOCHECK 0 # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) -# define png_fileno _fileno # define png_snprintf _fsnprintf /* Added to v 1.2.19 */ # define png_strlen _fstrlen # define png_memcmp _fmemcmp /* SJT: added */ @@ -1448,11 +1446,6 @@ typedef z_stream FAR * png_zstreamp; #else /* use the usual functions */ # define CVT_PTR(ptr) (ptr) # define CVT_PTR_NOCHECK(ptr) (ptr) -# ifdef _MSC_VER -# define png_fileno _fileno /* Added to v 1.2.36 */ -# else -# define png_fileno fileno -# endif # ifndef PNG_NO_SNPRINTF # ifdef _MSC_VER # define png_snprintf _snprintf /* Added to v 1.2.19 */ @@ -1474,7 +1467,6 @@ typedef z_stream FAR * png_zstreamp; # define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \ sprintf(s1,fmt,x1,x2,x3,x4,x5,x6) # endif -# define png_fileno fileno /* Added to v 1.2.36 */ # define png_strlen strlen # define png_memcmp memcmp /* SJT: added */ # define png_memcpy memcpy diff --git a/pngerror.c b/pngerror.c index 76521719..901dee59 100644 --- a/pngerror.c +++ b/pngerror.c @@ -1,7 +1,7 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.2.34 [December 18, 2008] + * Last changed in libpng 1.2.36 [March 21, 2009] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -44,7 +44,7 @@ png_error(png_structp png_ptr, png_const_charp error_message) { if (*error_message == '#') { - /* Strip "#nnnn " from beginning of error message. */ + /* Strip "#nnnn " from beginning of error message. */ int offset; for (offset = 1; offset<15; offset++) if (error_message[offset] == ' ') @@ -217,7 +217,7 @@ png_default_error(png_structp png_ptr, png_const_charp error_message) #ifdef PNG_ERROR_NUMBERS_SUPPORTED if (*error_message == '#') { - /* Strip "#nnnn " from beginning of warning message. */ + /* Strip "#nnnn " from beginning of error message. */ int offset; char error_number[16]; for (offset = 0; offset<15; offset++) @@ -229,15 +229,21 @@ png_default_error(png_structp png_ptr, png_const_charp error_message) if ((offset > 1) && (offset < 15)) { error_number[offset - 1] = '\0'; - fprintf(stderr, "libpng error no. %s: %s\n", error_number, - error_message + offset + 1); + fprintf(stderr, "libpng error no. %s: %s", + error_number, error_message + offset + 1); + fprintf(stderr, PNG_STRING_NEWLINE); } else - fprintf(stderr, "libpng error: %s, offset=%d\n", error_message, offset); + fprintf(stderr, "libpng error: %s, offset=%d", + error_message, offset); + fprintf(stderr, PNG_STRING_NEWLINE); } else #endif - fprintf(stderr, "libpng error: %s\n", error_message); + { + fprintf(stderr, "libpng error: %s", error_message); + fprintf(stderr, PNG_STRING_NEWLINE); + } #endif #ifdef PNG_SETJMP_SUPPORTED @@ -285,15 +291,23 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message) if ((offset > 1) && (offset < 15)) { warning_number[offset + 1] = '\0'; - fprintf(stderr, "libpng warning no. %s: %s\n", warning_number, - warning_message + offset); + fprintf(stderr, "libpng warning no. %s: %s", + warning_number, warning_message + offset); + fprintf(stderr, PNG_STRING_NEWLINE); } else - fprintf(stderr, "libpng warning: %s\n", warning_message); + { + fprintf(stderr, "libpng warning: %s", + warning_message); + fprintf(stderr, PNG_STRING_NEWLINE); + } } else # endif - fprintf(stderr, "libpng warning: %s\n", warning_message); + { + fprintf(stderr, "libpng warning: %s", warning_message); + fprintf(stderr, PNG_STRING_NEWLINE); + } #else warning_message = warning_message; /* make compiler happy */ #endif diff --git a/pngmem.c b/pngmem.c index e28476f7..f3394d78 100644 --- a/pngmem.c +++ b/pngmem.c @@ -425,6 +425,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn, need to allocate exactly 64K, so whatever you call here must have the ability to do that. */ + png_voidp PNGAPI png_malloc(png_structp png_ptr, png_uint_32 size) { diff --git a/pngread.c b/pngread.c index ace91bad..8e9c0cb7 100644 --- a/pngread.c +++ b/pngread.c @@ -1434,11 +1434,11 @@ png_read_png(png_structp png_ptr, png_infop info_ptr, { info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr, info_ptr->height * png_sizeof(png_bytep)); + png_memset(info_ptr->row_pointers, 0, info_ptr->height + * png_sizeof(png_bytep)); #ifdef PNG_FREE_ME_SUPPORTED info_ptr->free_me |= PNG_FREE_ROWS; #endif - png_memset(info_ptr->row_pointers, 0, info_ptr->height - * png_sizeof(png_bytep)); for (row = 0; row < (int)info_ptr->height; row++) info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr)); diff --git a/pngrio.c b/pngrio.c index 66beec30..1f85fd08 100644 --- a/pngrio.c +++ b/pngrio.c @@ -1,7 +1,7 @@ /* pngrio.c - functions for data input * - * Last changed in libpng 1.2.36 [February 28, 2009] + * Last changed in libpng 1.2.36 [March 21, 2009] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/pngrtran.c b/pngrtran.c index a916f54f..d7dd8e77 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -455,10 +455,8 @@ png_set_dither(png_structp png_ptr, png_colorp palette, int num_green = (1 << PNG_DITHER_GREEN_BITS); int num_blue = (1 << PNG_DITHER_BLUE_BITS); png_size_t num_entries = ((png_size_t)1 << total_bits); - png_ptr->palette_lookup = (png_bytep )png_malloc(png_ptr, (png_uint_32)(num_entries * png_sizeof(png_byte))); - png_memset(png_ptr->palette_lookup, 0, num_entries * png_sizeof(png_byte)); @@ -4125,14 +4123,13 @@ png_build_gamma_table(png_structp png_ptr) png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr, (png_uint_32)(num * png_sizeof(png_uint_16p))); + png_memset(png_ptr->gamma_16_table, 0, num * png_sizeof(png_uint_16p)); if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND)) { double fin, fout; png_uint_32 last, max; - png_memset(png_ptr->gamma_16_table, 0, num * png_sizeof(png_uint_16p)); - for (i = 0; i < num; i++) { png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr, @@ -4187,7 +4184,6 @@ png_build_gamma_table(png_structp png_ptr) png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr, (png_uint_32)(num * png_sizeof(png_uint_16p ))); - png_memset(png_ptr->gamma_16_to_1, 0, num * png_sizeof(png_uint_16p)); for (i = 0; i < num; i++) @@ -4212,7 +4208,6 @@ png_build_gamma_table(png_structp png_ptr) png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr, (png_uint_32)(num * png_sizeof(png_uint_16p))); - png_memset(png_ptr->gamma_16_from_1, 0, num * png_sizeof(png_uint_16p)); diff --git a/pngrutil.c b/pngrutil.c index 5fafde6c..24462a03 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -1,9 +1,9 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.2.34 [December 18, 2008] + * Last changed in libpng 1.2.36 [March 21, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -3187,9 +3187,11 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) if (row_bytes + 64 > png_ptr->old_big_row_buf_size) { png_free(png_ptr, png_ptr->big_row_buf); - png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes+64); - png_ptr->row_buf = png_ptr->big_row_buf+32; - png_ptr->old_big_row_buf_size = row_bytes+64; + png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes + 64); + if (png_ptr->interlaced) + png_memset(png_ptr->big_row_buf, 0, png_ptr->rowbytes + 64); + png_ptr->row_buf = png_ptr->big_row_buf + 32; + png_ptr->old_big_row_buf_size = row_bytes + 64; } #ifdef PNG_MAX_MALLOC_64K diff --git a/pngset.c b/pngset.c index 9e12b0db..daa64d85 100644 --- a/pngset.c +++ b/pngset.c @@ -383,10 +383,6 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr, return; } -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_PCAL; -#endif - png_memset(info_ptr->pcal_params, 0, (nparams + 1) * png_sizeof(png_charp)); for (i = 0; i < nparams; i++) @@ -404,6 +400,9 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr, } info_ptr->valid |= PNG_INFO_pCAL; +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_PCAL; +#endif } #endif @@ -961,7 +960,6 @@ png_set_sPLT(png_structp png_ptr, png_memcpy(np, info_ptr->splt_palettes, info_ptr->splt_palettes_num * png_sizeof(png_sPLT_t)); - png_free(png_ptr, info_ptr->splt_palettes); info_ptr->splt_palettes=NULL; diff --git a/pngtest.c b/pngtest.c index 6b7537d5..28c2ff98 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1,9 +1,9 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.2.32 [September 18, 2008] + * Last changed in libpng 1.2.36 [March 21, 2009] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2008 Glenn Randers-Pehrson + * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -362,12 +362,8 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length) static void pngtest_flush(png_structp png_ptr) { -#if !defined(_WIN32_WCE) - png_FILE_p io_ptr; - io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); - if (io_ptr != NULL) - fflush(io_ptr); -#endif + /* Do nothing; fflush() is said to be just a waste of energy. */ + png_ptr = png_ptr; /* stifle compiler warning */ } #endif @@ -1685,4 +1681,4 @@ main(int argc, char *argv[]) } /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_2_36beta01 your_png_h_is_not_version_1_2_36beta01; +typedef version_1_2_36beta02 your_png_h_is_not_version_1_2_36beta02; diff --git a/pngwio.c b/pngwio.c index 1f563358..57ac491c 100644 --- a/pngwio.c +++ b/pngwio.c @@ -1,7 +1,7 @@ /* pngwio.c - functions for data output * - * Last changed in libpng 1.2.36 [February 28, 2009] + * Last changed in libpng 1.2.36 [March 21, 2009] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -137,8 +137,7 @@ png_default_flush(png_structp png_ptr) if (png_ptr == NULL) return; #if !defined(_WIN32_WCE) io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); - if (io_ptr != NULL && png_fileno(io_ptr) != -1) - fflush(io_ptr); + fflush(io_ptr); #endif } #endif @@ -168,7 +167,10 @@ png_default_flush(png_structp png_ptr) PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time, output_flush_fn will be ignored, although it must be supplied for compatibility. May be NULL, in which case - libpng's default function will be used. */ + libpng's default function will be used, if + PNG_WRITE_FLUSH_SUPPORTED is defined. This is not + a good idea if io_ptr does not point to a standard + *FILE structure. */ void PNGAPI png_set_write_fn(png_structp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn) diff --git a/pngwutil.c b/pngwutil.c index 957e2668..47f35169 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -1759,9 +1759,9 @@ png_write_start_row(png_structp png_ptr) if (png_ptr->do_filter & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH)) { /* set up previous row buffer */ - png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, + png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size); - png_memset(png_ptr->prev_row, 0, buf_size); + png_memset(png_ptr->prev_row, 0, buf_size); if (png_ptr->do_filter & PNG_FILTER_UP) { diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 808c5a31..31e3e245 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -169,7 +169,7 @@ configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in # SET UP LINKS set_target_properties(${PNG_LIB_NAME} PROPERTIES -# VERSION 0.${PNGLIB_RELEASE}.1.2.36beta01 +# VERSION 0.${PNGLIB_RELEASE}.1.2.36beta02 VERSION 0.${PNGLIB_RELEASE}.0 SOVERSION 0 CLEAN_DIRECT_OUTPUT 1) diff --git a/scripts/libpng-config-head.in b/scripts/libpng-config-head.in index 2d4ae71e..bcf4d1c7 100755 --- a/scripts/libpng-config-head.in +++ b/scripts/libpng-config-head.in @@ -8,7 +8,7 @@ # Modeled after libxml-config. -version=1.2.36beta01 +version=1.2.36beta02 prefix="" libdir="" libs="" diff --git a/scripts/libpng.pc.in b/scripts/libpng.pc.in index 68528309..fbea96fc 100644 --- a/scripts/libpng.pc.in +++ b/scripts/libpng.pc.in @@ -5,6 +5,6 @@ includedir=@includedir@/libpng12 Name: libpng Description: Loads and saves PNG files -Version: 1.2.36beta01 +Version: 1.2.36beta02 Libs: -L${libdir} -lpng12 Cflags: -I${includedir} diff --git a/scripts/makefile.32sunu b/scripts/makefile.32sunu index 7226df08..d514549d 100644 --- a/scripts/makefile.32sunu +++ b/scripts/makefile.32sunu @@ -8,7 +8,7 @@ # Library name: LIBNAME=libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.64sunu b/scripts/makefile.64sunu index 7d82d7d1..e83641b6 100644 --- a/scripts/makefile.64sunu +++ b/scripts/makefile.64sunu @@ -8,7 +8,7 @@ # Library name: LIBNAME=libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.aix b/scripts/makefile.aix index d2110a1d..5b24d7b2 100644 --- a/scripts/makefile.aix +++ b/scripts/makefile.aix @@ -20,7 +20,7 @@ LN_SF = ln -f -s LIBNAME=libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) prefix=/usr/local diff --git a/scripts/makefile.beos b/scripts/makefile.beos index f47eedb1..42cf548b 100644 --- a/scripts/makefile.beos +++ b/scripts/makefile.beos @@ -8,7 +8,7 @@ # Library name: LIBNAME=libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.cygwin b/scripts/makefile.cygwin index 1363b64c..b996ddc5 100644 --- a/scripts/makefile.cygwin +++ b/scripts/makefile.cygwin @@ -74,7 +74,7 @@ CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \ LIBNAME = libpng12 PNGMAJ = 0 CYGDLL = 12 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) SHAREDLIB=cygpng$(CYGDLL).dll diff --git a/scripts/makefile.darwin b/scripts/makefile.darwin index 527c51b9..a827d4f6 100644 --- a/scripts/makefile.darwin +++ b/scripts/makefile.darwin @@ -19,7 +19,7 @@ ZLIBINC=../zlib # Library name: LIBNAME = libpng12 PNGMAJ = 12 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.dec b/scripts/makefile.dec index 17f9ba20..709df765 100644 --- a/scripts/makefile.dec +++ b/scripts/makefile.dec @@ -5,7 +5,7 @@ # Library name: PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) LIBNAME = libpng12 diff --git a/scripts/makefile.elf b/scripts/makefile.elf index 3d34e8f9..2cf42883 100644 --- a/scripts/makefile.elf +++ b/scripts/makefile.elf @@ -13,7 +13,7 @@ # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.gcmmx b/scripts/makefile.gcmmx index 9931d418..d9af7b6b 100644 --- a/scripts/makefile.gcmmx +++ b/scripts/makefile.gcmmx @@ -14,7 +14,7 @@ # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.hp64 b/scripts/makefile.hp64 index 602bb0e6..0f54db55 100644 --- a/scripts/makefile.hp64 +++ b/scripts/makefile.hp64 @@ -18,7 +18,7 @@ ZLIBINC=/opt/zlib/include # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.hpgcc b/scripts/makefile.hpgcc index 829c9fbf..cf2f41f3 100644 --- a/scripts/makefile.hpgcc +++ b/scripts/makefile.hpgcc @@ -8,7 +8,7 @@ # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.hpux b/scripts/makefile.hpux index 52bb90cb..b9ac9cca 100644 --- a/scripts/makefile.hpux +++ b/scripts/makefile.hpux @@ -18,7 +18,7 @@ ZLIBINC=/opt/zlib/include # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.linux b/scripts/makefile.linux index 61f77920..c1f78aac 100644 --- a/scripts/makefile.linux +++ b/scripts/makefile.linux @@ -7,7 +7,7 @@ # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.mingw b/scripts/makefile.mingw index 280f18a0..a03d25a6 100644 --- a/scripts/makefile.mingw +++ b/scripts/makefile.mingw @@ -74,7 +74,7 @@ CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \ LIBNAME = libpng12 PNGMAJ = 0 MINGDLL = 12 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) SHAREDLIB=libpng$(MINGDLL).dll diff --git a/scripts/makefile.ne12bsd b/scripts/makefile.ne12bsd index a454cf25..1db537eb 100644 --- a/scripts/makefile.ne12bsd +++ b/scripts/makefile.ne12bsd @@ -14,7 +14,7 @@ INCSDIR=${LOCALBASE}/include/libpng12 LIB= png12 SHLIB_MAJOR= 0 -SHLIB_MINOR= 1.2.36beta01 +SHLIB_MINOR= 1.2.36beta02 SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngwtran.c pngmem.c pngerror.c pngpread.c diff --git a/scripts/makefile.netbsd b/scripts/makefile.netbsd index 0888017a..efbb15aa 100644 --- a/scripts/makefile.netbsd +++ b/scripts/makefile.netbsd @@ -14,7 +14,7 @@ INCSDIR=${LOCALBASE}/include/libpng LIB= png SHLIB_MAJOR= 3 -SHLIB_MINOR= 1.2.36beta01 +SHLIB_MINOR= 1.2.36beta02 SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngwtran.c pngmem.c pngerror.c pngpread.c diff --git a/scripts/makefile.nommx b/scripts/makefile.nommx index c2dd33bb..896d01f1 100644 --- a/scripts/makefile.nommx +++ b/scripts/makefile.nommx @@ -7,7 +7,7 @@ # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.openbsd b/scripts/makefile.openbsd index 39d80e2c..3dec2f2b 100644 --- a/scripts/makefile.openbsd +++ b/scripts/makefile.openbsd @@ -8,7 +8,7 @@ LIBDIR= ${PREFIX}/lib MANDIR= ${PREFIX}/man/cat SHLIB_MAJOR= 0 -SHLIB_MINOR= 1.2.36beta01 +SHLIB_MINOR= 1.2.36beta02 LIB= png SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \ diff --git a/scripts/makefile.sco b/scripts/makefile.sco index 92e17d65..7610d983 100644 --- a/scripts/makefile.sco +++ b/scripts/makefile.sco @@ -9,7 +9,7 @@ # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc index 76e78843..7c132d4e 100644 --- a/scripts/makefile.sggcc +++ b/scripts/makefile.sggcc @@ -6,7 +6,7 @@ # Library name: LIBNAME=libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.sgi b/scripts/makefile.sgi index c07754f9..05e2392e 100644 --- a/scripts/makefile.sgi +++ b/scripts/makefile.sgi @@ -6,7 +6,7 @@ # Library name: LIBNAME=libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.so9 b/scripts/makefile.so9 index 1f52e083..595c91c6 100644 --- a/scripts/makefile.so9 +++ b/scripts/makefile.so9 @@ -8,7 +8,7 @@ # Library name: PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) LIBNAME = libpng12 diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris index fa23d59b..cbb72d53 100644 --- a/scripts/makefile.solaris +++ b/scripts/makefile.solaris @@ -8,7 +8,7 @@ # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/makefile.solaris-x86 b/scripts/makefile.solaris-x86 index 07b8b52e..69c58afa 100644 --- a/scripts/makefile.solaris-x86 +++ b/scripts/makefile.solaris-x86 @@ -8,7 +8,7 @@ # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.36beta01 +PNGMIN = 1.2.36beta02 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: diff --git a/scripts/pngos2.def b/scripts/pngos2.def index 73edaddf..b0723539 100644 --- a/scripts/pngos2.def +++ b/scripts/pngos2.def @@ -2,7 +2,7 @@ ; PNG.LIB module definition file for OS/2 ;---------------------------------------- -; Version 1.2.36beta01 +; Version 1.2.36beta02 LIBRARY PNG DESCRIPTION "PNG image compression library for OS/2" diff --git a/scripts/pngw32.def b/scripts/pngw32.def index d7c276e8..9152bdd4 100644 --- a/scripts/pngw32.def +++ b/scripts/pngw32.def @@ -5,7 +5,7 @@ LIBRARY EXPORTS -;Version 1.2.36beta01 +;Version 1.2.36beta02 png_build_grayscale_palette @1 png_check_sig @2 png_chunk_error @3