[libpng16] Made progressive reading of interlaced images consistent with the

behavior of the sequential reader and consistent with the manual. The
row_callback now receives the proper pass number and unexpanded rows,
when png_combine_row is not used or not built, by moving some code
out of the PNG_READ_INTERLACING_SUPPORTED blocks.
This commit is contained in:
Glenn Randers-Pehrson 2014-04-13 21:27:25 -05:00
parent 9f1aa186e6
commit 72855fb11e
8 changed files with 44 additions and 50 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.6.11beta04 - April 6, 2014
Libpng 1.6.11beta04 - April 13, 2014
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.
@ -47,7 +47,12 @@ Version 1.6.11beta03 [April 6, 2014]
Fixed a typo in pngrutil.c, introduced in libpng-1.5.6, that interferes
with "blocky" expansion of sub-8-bit interlaced PNG files (Eric Huss).
Version 1.6.11beta04 [April 6, 2014]
Version 1.6.11beta04 [April 13, 2014]
Made progressive reading of interlaced images consistent with the
behavior of the sequential reader and consistent with the manual. The
row_callback now receives the proper pass number and unexpanded rows,
when png_combine_row is not used or not built, by moving some code
out of the PNG_READ_INTERLACING_SUPPORTED blocks.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -4898,7 +4898,12 @@ Version 1.6.11beta03 [April 6, 2014]
with "blocky" expansion of sub-8-bit interlaced PNG files (Eric Huss).
Optionally use __builtin_bswap16() in png_do_swap().
Version 1.6.11beta04 [April 10, 2014]
Version 1.6.11beta04 [April 13, 2014]
Made progressive reading of interlaced images consistent with the
behavior of the sequential reader and consistent with the manual. The
row_callback now receives the proper pass number and unexpanded rows,
when png_combine_row is not used or not built, by moving some code
out of the PNG_READ_INTERLACING_SUPPORTED blocks.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.6.11beta04 - April 6, 2014
libpng version 1.6.11beta04 - April 13, 2014
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2014 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.6.11beta04 - April 6, 2014
libpng versions 0.97, January 1998, through 1.6.11beta04 - April 13, 2014
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -5076,16 +5076,16 @@ Libpng-1.6.0 through 1.6.2 used 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 caused
libpng to issue a "too far back" error and reject the file. Libpng-1.6.3 and
later calculate their own safe CMF from the image dimensions, provide a way
to revert to the libpng-1.5.x behavior (ignoring the CMF bytes and using a
32-kbyte sliding window), by using
zlib to issue the "invalid distance too far back" error and reject the file.
Libpng-1.6.3 and later calculate their own safe CMF from the image dimensions,
provide a way to revert to the libpng-1.5.x behavior (ignoring the CMF bytes
and using a 32-kbyte sliding window), by using
png_set_option(png_ptr, PNG_MAXIMUM_INFLATE_WINDOW,
PNG_OPTION_ON);
and provide a tool (contrib/tools/pngfix) for optimizing the CMF bytes
correctly.
and provide a tool (contrib/tools/pngfix) for rewriting a PNG file while
optimizing the CMF bytes in its IDAT chunk 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
@ -5261,7 +5261,7 @@ Other rules can be inferred by inspecting the libpng source.
XVI. Y2K Compliance in libpng
April 6, 2014
April 13, 2014
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.

View File

@ -1,4 +1,4 @@
.TH LIBPNG 3 "April 6, 2014"
.TH LIBPNG 3 "April 13, 2014"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.11beta04
.SH SYNOPSIS
@ -504,7 +504,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.6.11beta04 - April 6, 2014
libpng version 1.6.11beta04 - April 13, 2014
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -515,7 +515,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.6.11beta04 - April 6, 2014
libpng versions 0.97, January 1998, through 1.6.11beta04 - April 13, 2014
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -5580,16 +5580,16 @@ Libpng-1.6.0 through 1.6.2 used 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 caused
libpng to issue a "too far back" error and reject the file. Libpng-1.6.3 and
later calculate their own safe CMF from the image dimensions, provide a way
to revert to the libpng-1.5.x behavior (ignoring the CMF bytes and using a
32-kbyte sliding window), by using
zlib to issue the "invalid distance too far back" error and reject the file.
Libpng-1.6.3 and later calculate their own safe CMF from the image dimensions,
provide a way to revert to the libpng-1.5.x behavior (ignoring the CMF bytes
and using a 32-kbyte sliding window), by using
png_set_option(png_ptr, PNG_MAXIMUM_INFLATE_WINDOW,
PNG_OPTION_ON);
and provide a tool (contrib/tools/pngfix) for optimizing the CMF bytes
correctly.
and provide a tool (contrib/tools/pngfix) for rewriting a PNG file while
optimizing the CMF bytes in its IDAT chunk 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
@ -5765,7 +5765,7 @@ Other rules can be inferred by inspecting the libpng source.
.SH XVI. Y2K Compliance in libpng
April 6, 2014
April 13, 2014
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
@ -6062,7 +6062,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.6.11beta04 - April 6, 2014:
Libpng version 1.6.11beta04 - April 13, 2014:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@ -6085,7 +6085,7 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.6.11beta04, April 6, 2014, are
libpng versions 1.2.6, August 15, 2004, through 1.6.11beta04, April 13, 2014, 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
@ -6184,7 +6184,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
April 6, 2014
April 13, 2014
.\" end of man page

4
png.c
View File

@ -773,13 +773,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
"libpng version 1.6.11beta04 - April 6, 2014" PNG_STRING_NEWLINE \
"libpng version 1.6.11beta04 - April 13, 2014" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2014 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.6.11beta04 - April 6, 2014\
return "libpng version 1.6.11beta04 - April 13, 2014\
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";

12
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.6.11beta04 - April 6, 2014
* libpng version 1.6.11beta04 - April 13, 2014
* Copyright (c) 1998-2014 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.6.11beta04 - April 6, 2014: Glenn
* libpng versions 0.97, January 1998, through 1.6.11beta04 - April 13, 2014: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -227,7 +227,7 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.2.6, August 15, 2004, through 1.6.11beta04, April 6, 2014, are
* libpng versions 1.2.6, August 15, 2004, through 1.6.11beta04, April 13, 2014, 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:
@ -339,7 +339,7 @@
* Y2K compliance in libpng:
* =========================
*
* April 6, 2014
* April 13, 2014
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
@ -409,7 +409,7 @@
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.6.11beta04"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.6.11beta04 - April 6, 2014\n"
" libpng version 1.6.11beta04 - April 13, 2014\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
@ -1852,7 +1852,6 @@ PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structrp, int save));
*/
PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Function that combines rows. 'new_row' is a flag that should come from
* the callback and be non-NULL if anything needs to be done; the library
* stores its own version of the new data internally and ignores the passed
@ -1860,7 +1859,6 @@ PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
*/
PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr,
png_bytep old_row, png_const_bytep new_row));
#endif /* PNG_READ_INTERLACING_SUPPORTED */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr,

View File

@ -1154,7 +1154,6 @@ png_push_process_row(png_structrp png_ptr)
}
}
else
#endif
{
png_push_have_row(png_ptr, png_ptr->row_buf + 1);
png_read_push_finish_row(png_ptr);
@ -1164,7 +1163,6 @@ png_push_process_row(png_structrp png_ptr)
void /* PRIVATE */
png_read_push_finish_row(png_structrp png_ptr)
{
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */
@ -1189,7 +1187,6 @@ png_read_push_finish_row(png_structrp png_ptr)
if (png_ptr->row_number < png_ptr->num_rows)
return;
#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced)
{
png_ptr->row_number = 0;
@ -1224,7 +1221,6 @@ png_read_push_finish_row(png_structrp png_ptr)
} while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
}
#endif /* PNG_READ_INTERLACING_SUPPORTED */
}
void /* PRIVATE */
@ -1249,7 +1245,6 @@ png_push_have_row(png_structrp png_ptr, png_bytep row)
(int)png_ptr->pass);
}
#ifdef PNG_READ_INTERLACING_SUPPORTED
void PNGAPI
png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
png_const_bytep new_row)
@ -1262,9 +1257,8 @@ png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
* it must be png_ptr->row_buf+1
*/
if (new_row != NULL)
png_combine_row(png_ptr, old_row, 1/*display*/);
png_combine_row(png_ptr, old_row, 1/*blocky display*/);
}
#endif /* PNG_READ_INTERLACING_SUPPORTED */
void PNGAPI
png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr,

View File

@ -3464,7 +3464,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
/* Here if pixel_depth < 8 to check 'end_ptr' below. */
}
else
#endif
#endif /* PNG_READ_INTERLACING_SUPPORTED */
/* If here then the switch above wasn't used so just memcpy the whole row
* from the temporary row buffer (notice that this overwrites the end of the
@ -4114,7 +4114,6 @@ png_read_finish_IDAT(png_structrp png_ptr)
void /* PRIVATE */
png_read_finish_row(png_structrp png_ptr)
{
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */
@ -4128,14 +4127,12 @@ png_read_finish_row(png_structrp png_ptr)
/* Offset to next interlace block in the y direction */
static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif /* PNG_READ_INTERLACING_SUPPORTED */
png_debug(1, "in png_read_finish_row");
png_ptr->row_number++;
if (png_ptr->row_number < png_ptr->num_rows)
return;
#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced)
{
png_ptr->row_number = 0;
@ -4173,7 +4170,6 @@ png_read_finish_row(png_structrp png_ptr)
if (png_ptr->pass < 7)
return;
}
#endif /* PNG_READ_INTERLACING_SUPPORTED */
/* Here after at the end of the last row of the last pass. */
png_read_finish_IDAT(png_ptr);
@ -4183,7 +4179,6 @@ png_read_finish_row(png_structrp png_ptr)
void /* PRIVATE */
png_read_start_row(png_structrp png_ptr)
{
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */
@ -4197,7 +4192,6 @@ png_read_start_row(png_structrp png_ptr)
/* Offset to next interlace block in the y direction */
static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif
int max_pixel_depth;
png_size_t row_bytes;
@ -4207,7 +4201,6 @@ png_read_start_row(png_structrp png_ptr)
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
png_init_read_transformations(png_ptr);
#endif
#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced)
{
if (!(png_ptr->transformations & PNG_INTERLACE))
@ -4224,7 +4217,6 @@ png_read_start_row(png_structrp png_ptr)
}
else
#endif /* PNG_READ_INTERLACING_SUPPORTED */
{
png_ptr->num_rows = png_ptr->height;
png_ptr->iwidth = png_ptr->width;