mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng17] Port recent zlib windowBits handling from libpng-1.6.3beta06
This commit is contained in:
parent
0cc23ac171
commit
bd56d76417
17
ANNOUNCE
17
ANNOUNCE
@ -285,6 +285,23 @@ Version 1.7.0beta13 [May 10, 2013]
|
||||
Added a call to png_set_packing()
|
||||
Initialize dimension values so if sscanf fails at least we have known
|
||||
invalid values.
|
||||
Calculate our own zlib windowBits when decoding rather than trusting the
|
||||
CMF bytes in the PNG datastream.
|
||||
Added an option to force maximum window size for inflating, which was
|
||||
the behavior of libpng15 and earlier.
|
||||
Added png-fix-itxt and png-fix-too-far-back to the built programs and
|
||||
removed warnings from the source code and timepng that are revealed as
|
||||
a result.
|
||||
Detect wrong libpng versions linked to png-fix-too-far-back, which currently
|
||||
only works with libpng versions that can be made to reliably fail when
|
||||
the deflate data contains an out-of-window reference. This means only
|
||||
1.6 and later.
|
||||
Attempt to detect configuration issues with png-fix-too-far-back, which
|
||||
requires both the correct libpng and the correct zlib to function
|
||||
correctly.
|
||||
Check ZLIB_VERNUM for mismatches, enclose #error in quotes
|
||||
Added information in the documentation about problems with and fixes for
|
||||
the bad CRC and bad iTXt chunk situations.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
17
CHANGES
17
CHANGES
@ -4573,6 +4573,23 @@ Version 1.7.0beta13 [May 10, 2013]
|
||||
Added a call to png_set_packing()
|
||||
Initialize dimension values so if sscanf fails at least we have known
|
||||
invalid values.
|
||||
Calculate our own zlib windowBits when decoding rather than trusting the
|
||||
CMF bytes in the PNG datastream.
|
||||
Added an option to force maximum window size for inflating, which was
|
||||
the behavior of libpng15 and earlier.
|
||||
Added png-fix-itxt and png-fix-too-far-back to the built programs and
|
||||
removed warnings from the source code and timepng that are revealed as
|
||||
a result.
|
||||
Detect wrong libpng versions linked to png-fix-too-far-back, which currently
|
||||
only works with libpng versions that can be made to reliably fail when
|
||||
the deflate data contains an out-of-window reference. This means only
|
||||
1.6 and later.
|
||||
Attempt to detect configuration issues with png-fix-too-far-back, which
|
||||
requires both the correct libpng and the correct zlib to function
|
||||
correctly.
|
||||
Check ZLIB_VERNUM for mismatches, enclose #error in quotes
|
||||
Added information in the documentation about problems with and fixes for
|
||||
the bad CRC and bad iTXt chunk situations.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
4
LICENSE
4
LICENSE
@ -10,7 +10,7 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.7.0beta13, April 30, 2013, are
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.7.0beta13, May 10, 2013, are
|
||||
Copyright (c) 2004, 2006-2013 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
|
||||
@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
April 30, 2013
|
||||
May 10, 2013
|
||||
|
15
Makefile.am
15
Makefile.am
@ -9,6 +9,9 @@ ACLOCAL_AMFLAGS = -I scripts
|
||||
# test programs - run on make check, make distcheck
|
||||
check_PROGRAMS= pngtest pngunknown pngstest pngvalid
|
||||
|
||||
# Utilities - installed
|
||||
bin_PROGRAMS= png-fix-too-far-back png-fix-itxt
|
||||
|
||||
pngtest_SOURCES = pngtest.c
|
||||
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
|
||||
@ -21,6 +24,11 @@ pngstest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
pngunknown_SOURCES = contrib/libtests/pngunknown.c
|
||||
pngunknown_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
|
||||
png_fix_too_far_back_SOURCES = contrib/tools/png-fix-too-far-back.c
|
||||
png_fix_too_far_back_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
|
||||
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
|
||||
|
||||
# Generally these are single line shell scripts to run a test with a particular
|
||||
# set of parameters:
|
||||
TESTS =\
|
||||
@ -182,14 +190,15 @@ endif
|
||||
$(srcdir)/scripts/pnglibconf.h.prebuilt:
|
||||
@echo "Attempting to build $@" >&2
|
||||
@echo "This is a machine generated file, but if you want to make" >&2
|
||||
@echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
|
||||
@echo "a new one simply make 'scripts/pnglibconf.out', copy that" >&2
|
||||
@echo "AND set PNG_ZLIB_VERNUM to 0 (you MUST do this)" >&2
|
||||
@exit 1
|
||||
|
||||
# The following is necessary to ensure that the local pnglibconf.h is used, not
|
||||
# an installed one (this can happen immediately after on a clean system if
|
||||
# 'make test' is the first thing the user does.)
|
||||
contrib/libtests/pngstest.o contrib/libtests/pngvalid.o pngtest.o: pnglibconf.h
|
||||
contrib/libtests/pngunknown.o: pnglibconf.h
|
||||
pngstest.o pngvalid.o pngtest.o pngunknown.o timepng.o: pnglibconf.h
|
||||
png-fix-too-far-back.o png-fix-itxt.o: pnglibconf.h
|
||||
|
||||
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
|
||||
# be built with PNG_USE_READ_MACROS; this prevents the read macros from
|
||||
|
2
README
2
README
@ -1,4 +1,4 @@
|
||||
README for libpng version 1.7.0beta13 - April 30, 2013 (shared library 17.0)
|
||||
README for libpng version 1.7.0beta13 - May 10, 2013 (shared library 17.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
|
153
contrib/tools/png-fix-itxt.c
Normal file
153
contrib/tools/png-fix-itxt.c
Normal file
@ -0,0 +1,153 @@
|
||||
|
||||
/* png-fix-itxt version 1.0.0
|
||||
*
|
||||
* Copyright 2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.3 [(PENDING RELEASE)]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* png-fix-itxt.exe < bad.png > good.png
|
||||
*
|
||||
* Fixes a PNG file written with libpng-1.6.0 or 1.6.1 that has one or more
|
||||
* uncompressed iTXt chunks. Assumes that the actual length is greater
|
||||
* than or equal to the value in the length byte, and that the CRC is
|
||||
* correct for the actual length. This program hunts for the CRC and
|
||||
* adjusts the length byte accordingly. It is not an error to process a
|
||||
* PNG file that has no iTXt chunks or one that has valid iTXt chunks;
|
||||
* such files will simply be copied.
|
||||
*
|
||||
* Requires zlib (for crc32 and Z_NULL); build with
|
||||
*
|
||||
* gcc -O -o png-fix-itxt png-fix-itxt.c -lz
|
||||
*
|
||||
* If you need to handle iTXt chunks larger than 500000 kbytes you must
|
||||
* rebuild png-fix-itxt with a larger values of MAX_LENGTH (or a smaller value
|
||||
* if you know you will never encounter such huge iTXt chunks).
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#define MAX_LENGTH 500000
|
||||
|
||||
#define GETBREAK ((unsigned char)(inchar=getchar())); if (inchar == EOF) break
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned char buf[MAX_LENGTH];
|
||||
unsigned long crc;
|
||||
unsigned char c;
|
||||
int inchar;
|
||||
|
||||
/* Skip 8-byte signature */
|
||||
for (i=8; i; i--)
|
||||
{
|
||||
c=GETBREAK;
|
||||
putchar(c);
|
||||
}
|
||||
|
||||
if (inchar != EOF)
|
||||
for (;;)
|
||||
{
|
||||
/* Read the length */
|
||||
unsigned long length; /* must be 32 bits! */
|
||||
c=GETBREAK; buf[0] = c; length = c; length <<= 8;
|
||||
c=GETBREAK; buf[1] = c; length += c; length <<= 8;
|
||||
c=GETBREAK; buf[2] = c; length += c; length <<= 8;
|
||||
c=GETBREAK; buf[3] = c; length += c;
|
||||
|
||||
/* Read the chunkname */
|
||||
c=GETBREAK; buf[4] = c;
|
||||
c=GETBREAK; buf[5] = c;
|
||||
c=GETBREAK; buf[6] = c;
|
||||
c=GETBREAK; buf[7] = c;
|
||||
|
||||
|
||||
/* The iTXt chunk type expressed as integers is (105, 84, 88, 116) */
|
||||
if (buf[4] == 105 && buf[5] == 84 && buf[6] == 88 && buf[7] == 116)
|
||||
{
|
||||
if (length >= MAX_LENGTH-12)
|
||||
break; /* To do: handle this more gracefully */
|
||||
|
||||
/* Initialize the CRC */
|
||||
crc = crc32(0, Z_NULL, 0);
|
||||
|
||||
/* Copy the data bytes */
|
||||
for (i=8; i < length + 12; i++)
|
||||
{
|
||||
c=GETBREAK; buf[i] = c;
|
||||
}
|
||||
|
||||
/* Calculate the CRC */
|
||||
crc = crc32(crc, buf+4, (uInt)length+4);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/* Check the CRC */
|
||||
if (((crc >> 24) & 0xff) == buf[length+8] &&
|
||||
((crc >> 16) & 0xff) == buf[length+9] &&
|
||||
((crc >> 8) & 0xff) == buf[length+10] &&
|
||||
((crc ) & 0xff) == buf[length+11])
|
||||
break;
|
||||
|
||||
length++;
|
||||
|
||||
if (length >= MAX_LENGTH-12)
|
||||
break;
|
||||
|
||||
c=GETBREAK;
|
||||
buf[length+11]=c;
|
||||
|
||||
/* Update the CRC */
|
||||
crc = crc32(crc, buf+7+length, 1);
|
||||
}
|
||||
|
||||
/* Update length bytes */
|
||||
buf[0] = (length << 24) & 0xff;
|
||||
buf[1] = (length << 16) & 0xff;
|
||||
buf[2] = (length << 8) & 0xff;
|
||||
buf[3] = (length ) & 0xff;
|
||||
|
||||
/* Write the fixed iTXt chunk (length, name, data, crc) */
|
||||
for (i=0; i<length+12; i++)
|
||||
putchar(buf[i]);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* Copy bytes that were already read (length and chunk name) */
|
||||
for (i=0; i<8; i++)
|
||||
putchar(buf[i]);
|
||||
|
||||
/* Copy data bytes and CRC */
|
||||
for (i=8; i< length+12; i++)
|
||||
{
|
||||
c=GETBREAK;
|
||||
putchar(c);
|
||||
}
|
||||
|
||||
if (inchar == EOF)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/* The IEND chunk type expressed as integers is (73, 69, 78, 68) */
|
||||
if (buf[4] == 73 && buf[5] == 69 && buf[6] == 78 && buf[7] == 68)
|
||||
break;
|
||||
}
|
||||
|
||||
if (inchar == EOF)
|
||||
break;
|
||||
|
||||
if (buf[4] == 73 && buf[5] == 69 && buf[6] == 78 && buf[7] == 68)
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
1263
contrib/tools/png-fix-too-far-back.c
Normal file
1263
contrib/tools/png-fix-too-far-back.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.7.0beta13 - April 30, 2013
|
||||
libpng version 1.7.0beta13 - May 10, 2013
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.7.0beta13 - April 30, 2013
|
||||
libpng versions 0.97, January 1998, through 1.7.0beta13 - May 10, 2013
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
|
||||
@ -5021,6 +5021,21 @@ The machine-generated configure files are no longer included in branches
|
||||
libpng16 and later of the GIT repository. They continue to be included
|
||||
in the tarball releases, however.
|
||||
|
||||
Libpng-1.6.0 and later use the CMF bytes at the beginning of the IDAT stream
|
||||
to set the size of the sliding window for reading instead of using the default
|
||||
32-kbyte sliding window size. It was discovered that there are hundreds of PNG
|
||||
files in the wild that have incorrect CMF bytes that cause libpng to now issue
|
||||
a "too far back" error and reject the file. Libpng-1.6.3 provides a way to
|
||||
revert to the libpng-1.5.x behavior (ignoring the CMF bytes and using a
|
||||
32-kbyte sliding window), and provides a tool
|
||||
(contrib/tools/png-fix-too-far-back) for optimizing the CMF bytes
|
||||
correctly.
|
||||
|
||||
Libpng-1.6.0 and libpng-1.6.1 wrote uncompressed iTXt chunks with the wrong
|
||||
length, which resulted in PNG files that cannot be read beyond the bad iTXt
|
||||
chunk. This error was fixed in libpng-1.6.3, and a tool (called
|
||||
contrib/tools/png-fix-itxt) has been added to the libpng distribution.
|
||||
|
||||
XIII. Changes to Libpng from version 1.6.x to 1.7.x
|
||||
|
||||
Some functions that were deprecated in libpng-1.6.0 were removed:
|
||||
@ -5215,7 +5230,7 @@ Other rules can be inferred by inspecting the libpng source.
|
||||
|
||||
XVII. Y2K Compliance in libpng
|
||||
|
||||
April 30, 2013
|
||||
May 10, 2013
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
29
libpng.3
29
libpng.3
@ -1,4 +1,4 @@
|
||||
.TH LIBPNG 3 "April 30, 2013"
|
||||
.TH LIBPNG 3 "May 10, 2013"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta13
|
||||
.SH SYNOPSIS
|
||||
@ -494,7 +494,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
|
||||
.SH LIBPNG.TXT
|
||||
libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.7.0beta13 - April 30, 2013
|
||||
libpng version 1.7.0beta13 - May 10, 2013
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
@ -505,7 +505,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.7.0beta13 - April 30, 2013
|
||||
libpng versions 0.97, January 1998, through 1.7.0beta13 - May 10, 2013
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
|
||||
@ -5516,6 +5516,21 @@ The machine-generated configure files are no longer included in branches
|
||||
libpng16 and later of the GIT repository. They continue to be included
|
||||
in the tarball releases, however.
|
||||
|
||||
Libpng-1.6.0 and later use the CMF bytes at the beginning of the IDAT stream
|
||||
to set the size of the sliding window for reading instead of using the default
|
||||
32-kbyte sliding window size. It was discovered that there are hundreds of PNG
|
||||
files in the wild that have incorrect CMF bytes that cause libpng to now issue
|
||||
a "too far back" error and reject the file. Libpng-1.6.3 provides a way to
|
||||
revert to the libpng-1.5.x behavior (ignoring the CMF bytes and using a
|
||||
32-kbyte sliding window), and provides a tool
|
||||
(contrib/tools/png-fix-too-far-back) for optimizing the CMF bytes
|
||||
correctly.
|
||||
|
||||
Libpng-1.6.0 and libpng-1.6.1 wrote uncompressed iTXt chunks with the wrong
|
||||
length, which resulted in PNG files that cannot be read beyond the bad iTXt
|
||||
chunk. This error was fixed in libpng-1.6.3, and a tool (called
|
||||
contrib/tools/png-fix-itxt) has been added to the libpng distribution.
|
||||
|
||||
.SH XIII. Changes to Libpng from version 1.6.x to 1.7.x
|
||||
|
||||
Some functions that were deprecated in libpng-1.6.0 were removed:
|
||||
@ -5710,7 +5725,7 @@ Other rules can be inferred by inspecting the libpng source.
|
||||
|
||||
.SH XVII. Y2K Compliance in libpng
|
||||
|
||||
April 30, 2013
|
||||
May 10, 2013
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
@ -5980,7 +5995,7 @@ possible without all of you.
|
||||
|
||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
|
||||
Libpng version 1.7.0beta13 - April 30, 2013:
|
||||
Libpng version 1.7.0beta13 - May 10, 2013:
|
||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
||||
|
||||
@ -6003,7 +6018,7 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.7.0beta13, April 30, 2013, are
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.7.0beta13, May 10, 2013, are
|
||||
Copyright (c) 2004,2006-2007 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
|
||||
@ -6102,7 +6117,7 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
April 30, 2013
|
||||
May 10, 2013
|
||||
|
||||
.\" end of man page
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH LIBPNGPF 3 "April 30, 2013"
|
||||
.TH LIBPNGPF 3 "May 10, 2013"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta13
|
||||
(private functions)
|
||||
|
2
png.5
2
png.5
@ -1,4 +1,4 @@
|
||||
.TH PNG 5 "April 30, 2013"
|
||||
.TH PNG 5 "May 10, 2013"
|
||||
.SH NAME
|
||||
png \- Portable Network Graphics (PNG) format
|
||||
.SH DESCRIPTION
|
||||
|
4
png.c
4
png.c
@ -691,13 +691,13 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.7.0beta13 - April 30, 2013" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.7.0beta13 - May 10, 2013" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2013 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||
PNG_STRING_NEWLINE;
|
||||
# else
|
||||
return "libpng version 1.7.0beta13 - April 30, 2013\
|
||||
return "libpng version 1.7.0beta13 - May 10, 2013\
|
||||
Copyright (c) 1998-2013 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
|
13
png.h
13
png.h
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.7.0beta13 - April 30, 2013
|
||||
* libpng version 1.7.0beta13 - May 10, 2013
|
||||
* Copyright (c) 1998-2013 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.)
|
||||
@ -11,7 +11,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.7.0beta13 - April 30, 2013: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.7.0beta13 - May 10, 2013: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
@ -200,7 +200,7 @@
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.7.0beta13, April 30, 2013, are
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.7.0beta13, May 10, 2013, are
|
||||
* Copyright (c) 2004, 2006-2013 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:
|
||||
@ -312,7 +312,7 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* April 30, 2013
|
||||
* May 10, 2013
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
@ -380,7 +380,7 @@
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.7.0beta13"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.7.0beta13 - April 30, 2013\n"
|
||||
" libpng version 1.7.0beta13 - May 10, 2013\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 17
|
||||
#define PNG_LIBPNG_VER_DLLNUM 17
|
||||
@ -2916,7 +2916,8 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structrp png_ptr,
|
||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||
# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
|
||||
#endif
|
||||
#define PNG_OPTION_NEXT 2 /* Next option - numbers must be even */
|
||||
#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
|
||||
#define PNG_OPTION_NEXT 4 /* Next option - numbers must be even */
|
||||
|
||||
/* Return values: NOTE: there are four values and 'off' is *not* zero */
|
||||
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.7.0beta13 - April 30, 2013
|
||||
* libpng version 1.7.0beta13 - May 10, 2013
|
||||
*
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
18
pngpriv.h
18
pngpriv.h
@ -629,6 +629,24 @@
|
||||
#include "pngstruct.h"
|
||||
#include "pnginfo.h"
|
||||
|
||||
/* Validate the include paths - the include path used to generate pnglibconf.h
|
||||
* must match that used in the build, or we must be using pnglibconf.h.prebuilt:
|
||||
*/
|
||||
#if PNG_ZLIB_VERNUM != 0 && PNG_ZLIB_VERNUM != ZLIB_VERNUM
|
||||
# error ZLIB_VERNUM != PNG_ZLIB_VERNUM \
|
||||
"-I (include path) error: see the notes in pngpriv.h"
|
||||
/* This means that when pnglibconf.h was built the copy of zlib.h that it
|
||||
* used is not the same as the one being used here. Because the build of
|
||||
* libpng makes decisions to use inflateInit2 and inflateReset2 based on the
|
||||
* zlib version number and because this affects handling of certain broken
|
||||
* PNG files the -I directives must match.
|
||||
*
|
||||
* The most likely explanation is that you passed a -I in CFLAGS, this will
|
||||
* not work; all the preprocessor directories and in particular all the -I
|
||||
* directives must be in CPPFLAGS.
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* This is used for 16 bit gamma tables -- only the top level pointers are
|
||||
* const; this could be changed:
|
||||
*/
|
||||
|
42
pngrutil.c
42
pngrutil.c
@ -311,7 +311,7 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
|
||||
* chunk apparently owns the stream. Prior to release it does a png_error.
|
||||
*/
|
||||
static int
|
||||
png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
||||
png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
|
||||
{
|
||||
if (png_ptr->zowner != 0)
|
||||
{
|
||||
@ -346,6 +346,22 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
||||
*/
|
||||
{
|
||||
int ret; /* zlib return code */
|
||||
# if PNG_ZLIB_VERNUM >= 0x1240
|
||||
|
||||
# if defined(PNG_SET_OPTION_SUPPORTED) && \
|
||||
defined(PNG_MAXIMUM_INFLATE_WINDOW)
|
||||
int window_bits;
|
||||
|
||||
if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) ==
|
||||
PNG_OPTION_ON)
|
||||
window_bits = 15;
|
||||
|
||||
else
|
||||
window_bits = 0;
|
||||
# else
|
||||
# define window_bits 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Set this for safety, just in case the previous owner left pointers to
|
||||
* memory allocations.
|
||||
@ -357,8 +373,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
||||
|
||||
if (png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED)
|
||||
{
|
||||
# if ZLIB_VERNUM < 0x1240
|
||||
PNG_UNUSED(window_bits)
|
||||
# if PNG_ZLIB_VERNUM < 0x1240
|
||||
ret = inflateReset(&png_ptr->zstream);
|
||||
# else
|
||||
ret = inflateReset2(&png_ptr->zstream, window_bits);
|
||||
@ -367,7 +382,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
||||
|
||||
else
|
||||
{
|
||||
# if ZLIB_VERNUM < 0x1240
|
||||
# if PNG_ZLIB_VERNUM < 0x1240
|
||||
ret = inflateInit(&png_ptr->zstream);
|
||||
# else
|
||||
ret = inflateInit2(&png_ptr->zstream, window_bits);
|
||||
@ -385,6 +400,10 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner, int window_bits)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
# ifdef window_bits
|
||||
# undef window_bits
|
||||
# endif
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED
|
||||
@ -557,14 +576,8 @@ png_decompress_chunk(png_structrp png_ptr,
|
||||
if (limit < *newlength)
|
||||
*newlength = limit;
|
||||
|
||||
/* Now try to claim the stream; the 'warn' setting causes zlib to be told
|
||||
* to use the maximum window size during inflate; this hides errors in the
|
||||
* deflate header window bits value which is used if '0' is passed. In
|
||||
* fact this only has an effect with zlib versions 1.2.4 and later - see
|
||||
* the comments in png_inflate_claim above.
|
||||
*/
|
||||
ret = png_inflate_claim(png_ptr, png_ptr->chunk_name,
|
||||
png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN ? 15 : 0);
|
||||
/* Now try to claim the stream. */
|
||||
ret = png_inflate_claim(png_ptr, png_ptr->chunk_name);
|
||||
|
||||
if (ret == Z_OK)
|
||||
{
|
||||
@ -1334,8 +1347,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
{
|
||||
read_length -= keyword_length+2;
|
||||
|
||||
if (png_inflate_claim(png_ptr, png_iCCP,
|
||||
png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN ? 15 : 0) == Z_OK)
|
||||
if (png_inflate_claim(png_ptr, png_iCCP) == Z_OK)
|
||||
{
|
||||
Byte profile_header[132];
|
||||
Byte local_buffer[PNG_INFLATE_BUF_SIZE];
|
||||
@ -4412,7 +4424,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
* IDAT stream has a bogus deflate header window_bits value, but this should
|
||||
* not be happening any longer!)
|
||||
*/
|
||||
if (png_inflate_claim(png_ptr, png_IDAT, 0) != Z_OK)
|
||||
if (png_inflate_claim(png_ptr, png_IDAT) != Z_OK)
|
||||
png_error(png_ptr, png_ptr->zstream.msg);
|
||||
|
||||
png_ptr->flags |= PNG_FLAG_ROW_INIT;
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
VisualStudio instructions
|
||||
|
||||
libpng version 1.7.0beta13 - April 30, 2013
|
||||
libpng version 1.7.0beta13 - May 10, 2013
|
||||
|
||||
Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!--
|
||||
* zlib.props - location of zlib source
|
||||
*
|
||||
* libpng version 1.7.0beta13 - April 30, 2013
|
||||
* libpng version 1.7.0beta13 - May 10, 2013
|
||||
*
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
Makefiles for libpng version 1.7.0beta13 - April 30, 2013
|
||||
Makefiles for libpng version 1.7.0beta13 - May 10, 2013
|
||||
|
||||
pnglibconf.h.prebuilt => Stores configuration settings
|
||||
makefile.linux => Linux/ELF makefile
|
||||
|
@ -238,6 +238,7 @@ option SET_OPTION disabled
|
||||
# ARM_NEON: the optimization itself
|
||||
# ARM_NEON_API: allow the optimization to be switched on with png_set_hardware
|
||||
# ARM_NEON_CHECK: compile a run-time check to see if Neon extensions are
|
||||
setting ZLIB_VERNUM default @ZLIB_VERNUM
|
||||
# supported, this is poorly supported and deprectated - use the
|
||||
# png_set_hardware API.
|
||||
option ARM_NEON disabled,
|
||||
@ -425,7 +426,7 @@ option SET_USER_LIMITS requires USER_LIMITS
|
||||
# to libpng 1.6; the new interfaces in 1.6 will take several years to become
|
||||
# popular.
|
||||
|
||||
option READ enables READ_INTERLACING
|
||||
option READ enables READ_INTERLACING SET_OPTION
|
||||
|
||||
# Disabling READ_16BIT does not disable reading 16-bit PNG files, but it
|
||||
# forces them to be chopped down to 8-bit, and disables any 16-bit
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/* pnglibconf.h - library build configuration */
|
||||
|
||||
/* Libpng version 1.7.0beta13 - April 30, 2013 */
|
||||
/* Libpng version 1.7.0beta13 - May 10, 2013 */
|
||||
|
||||
/* Copyright (c) 1998-2013 Glenn Randers-Pehrson */
|
||||
|
||||
@ -103,7 +103,7 @@
|
||||
#define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#define PNG_SEQUENTIAL_READ_SUPPORTED
|
||||
#define PNG_SETJMP_SUPPORTED
|
||||
/*#undef PNG_SET_OPTION_SUPPORTED*/
|
||||
#define PNG_SET_OPTION_SUPPORTED
|
||||
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#define PNG_SET_USER_LIMITS_SUPPORTED
|
||||
#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
|
||||
@ -200,6 +200,7 @@
|
||||
#define PNG_TEXT_Z_DEFAULT_COMPRESSION (-1)
|
||||
#define PNG_TEXT_Z_DEFAULT_STRATEGY 0
|
||||
#define PNG_WEIGHT_SHIFT 8
|
||||
#define PNG_ZLIB_VERNUM 0 /* unknown */
|
||||
#define PNG_ZBUF_SIZE 8192
|
||||
#define PNG_ZLIB_HEADER <zlib.h>
|
||||
#define PNG_Z_DEFAULT_COMPRESSION (-1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user