From 771eb7d01e448dc6f9db093408db6d82de3a4209 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sun, 22 Nov 2015 22:35:35 -0600 Subject: [PATCH 1/2] [libpng17] Update CHANGES, ANNOUNCE, pnglibconf.h.prebuilt --- ANNOUNCE | 32 ++++++++++++++++++++++++++++++++ CHANGES | 33 +++++++++++++++++++++++++++++++++ png.c | 4 ++-- png.h | 10 +++++----- pngconf.h | 2 +- pngrutil.c | 2 +- scripts/pnglibconf.dfa | 2 +- scripts/pnglibconf.h.prebuilt | 3 ++- 8 files changed, 77 insertions(+), 11 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index e58855b75..2174556ac 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -972,6 +972,38 @@ Version 1.7.0beta69 [November 23, 2015] by flaviommedeiros). Fixed bug recently introduced in png_set_PLTE() that uses png_ptr not info_ptr. + Added pngvalid --transform --interlace test. This increases code + coverage by generating test cases with smaller length rows as a + result of the interlacing. Without this packswap handling was + incompletely tested. + Fixed NO_WRITE_INTERLACE in pngvalid.c. The support for writing + interlaced images directly from libpng 1.7 was unintentionally + disabled (INTERLACE_LAST was defined incorrectly, excluding the + interlaced images). This obscured the fact that the transform and + error test case generators lacked the support for writing interlaced + images from libpng. + Transform rewrite: perform transforms in small chunks. The intent + of this change is to reduce the memory footprint during transform + sequences by performing transforms in fixed (small) sized blocks of + pixels. The change is incomplete; the filter code still works + row-by-row, so the whole tranform also works row-by-row. The intent + is to fix this so that everything works in small(ish) chunks. + At present the change has no discernable effect on pngvalid --speed + or pngstest with (e.g.) rgb-8-1.8.png; user time and (minor) page + faults are the same in old and new versions. The same applies to + real-world 15MP PNG images; even on these the presence of the filter + code causes a cyclical progress through memory which will interfere + with any caching otherwise possible (useful word, 'otherwise'.) + Read row buffer changes. The read code now allocates one row buffer + of the size of the input PNG row and, only if required, one buffer of + the size of the output. The output buffer is required for the + progressive reader (always) and for the sequential reader if libpng + is de-interlacing an image (because the output row is used multiple + times if png_read_row is called with a display row parameter.) This + should reduce memory utilization by libpng significantly, but it has no + detectable effect on overall performance figures of the test programs; + these are probably dominated by memory allocations for the whole image + within the test programs. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index b6e143464..659e66f56 100644 --- a/CHANGES +++ b/CHANGES @@ -5271,6 +5271,39 @@ Version 1.7.0beta69 [November 23, 2015] by flaviommedeiros). Fixed bug recently introduced in png_set_PLTE() that uses png_ptr not info_ptr. + Added pngvalid --transform --interlace test. This increases code + coverage by generating test cases with smaller length rows as a + result of the interlacing. Without this packswap handling was + incompletely tested. + Fixed NO_WRITE_INTERLACE in pngvalid.c. The support for writing + interlaced images directly from libpng 1.7 was unintentionally + disabled (INTERLACE_LAST was defined incorrectly, excluding the + interlaced images). This obscured the fact that the transform and + error test case generators lacked the support for writing interlaced + images from libpng. + Transform rewrite: perform transforms in small chunks. The intent + of this change is to reduce the memory footprint during transform + sequences by performing transforms in fixed (small) sized blocks of + pixels. The change is incomplete; the filter code still works + row-by-row, so the whole tranform also works row-by-row. The intent + is to fix this so that everything works in small(ish) chunks. + At present the change has no discernable effect on pngvalid --speed + or pngstest with (e.g.) rgb-8-1.8.png; user time and (minor) page + faults are the same in old and new versions. The same applies to + real-world 15MP PNG images; even on these the presence of the filter + code causes a cyclical progress through memory which will interfere + with any caching otherwise possible (useful word, 'otherwise'.) + Read row buffer changes. The read code now allocates one row buffer + of the size of the input PNG row and, only if required, one buffer of + the size of the output. The output buffer is required for the + progressive reader (always) and for the sequential reader if libpng + is de-interlacing an image (because the output row is used multiple + times if png_read_row is called with a display row parameter.) This + should reduce memory utilization by libpng significantly, but it has no + detectable effect on overall performance figures of the test programs; + these are probably dominated by memory allocations for the whole image + within the test programs. + Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/png.c b/png.c index 715488e53..9ded9d962 100644 --- a/png.c +++ b/png.c @@ -711,13 +711,13 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.7.0beta69 - November 22, 2015" PNG_STRING_NEWLINE \ + "libpng version 1.7.0beta69 - November 23, 2015" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2015 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.0beta69 - November 22, 2015\ + return "libpng version 1.7.0beta69 - November 23, 2015\ Copyright (c) 1998-2015 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; diff --git a/png.h b/png.h index fc25e3e34..32dda2b68 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.7.0beta69, November 13, 2015 + * libpng version 1.7.0beta69, November 23, 2015 * * Copyright (c) 1998-2015 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -12,7 +12,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.7.0beta69, November 13, 2015: + * libpng versions 0.97, January 1998, through 1.7.0beta69, November 23, 2015: * Glenn Randers-Pehrson. * See also "Contributing Authors", below. */ @@ -25,7 +25,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.0.7, July 1, 2000, through 1.7.0beta69, November 13, 2015, are + * libpng versions 1.0.7, July 1, 2000, through 1.7.0beta69, November 23, 2015, are * Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are * derived from libpng-1.0.6, and are distributed according to the same * disclaimer and license as libpng-1.0.6 with the following individuals @@ -218,7 +218,7 @@ * Y2K compliance in libpng: * ========================= * - * November 13, 2015 + * November 23, 2015 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. @@ -288,7 +288,7 @@ /* Version information for png.h - this should match the version in png.c */ #define PNG_LIBPNG_VER_STRING "1.7.0beta69" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.7.0beta69 - November 13, 2015\n" + " libpng version 1.7.0beta69 - November 23, 2015\n" #define PNG_LIBPNG_VER_SONUM 17 #define PNG_LIBPNG_VER_DLLNUM 17 diff --git a/pngconf.h b/pngconf.h index 4a588f51d..4156a6fa0 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.7.0beta69, November 13, 2015 + * libpng version 1.7.0beta69, November 23, 2015 * * Copyright (c) 1998-2015 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/pngrutil.c b/pngrutil.c index 0d3c549ca..85b6d73df 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -1948,7 +1948,7 @@ png_handle_pCAL(png_structrp png_ptr, png_inforp info_ptr) /* We need to have at least 12 bytes after the purpose string * in order to get the parameter information. */ - if (endptr - buf <= 12) + if (endptr - buf <= 12U) { png_chunk_benign_error(png_ptr, "invalid"); return; diff --git a/scripts/pnglibconf.dfa b/scripts/pnglibconf.dfa index e13680e98..16105c8ce 100644 --- a/scripts/pnglibconf.dfa +++ b/scripts/pnglibconf.dfa @@ -964,7 +964,7 @@ option WRITE_PNG requires WRITE WRITE_TRANSFORMS enables INFO_IMAGE # Disabled by -DPNG_NO_CHECK_FOR_INVALID_INDEX # # 2) {READ,WRITE}_GET_PALETTE_MAX: returns the largest pixel value in a -# color mapped PNG. Disbaled by -DPNG_NO_GET_PALETTE_MAX +# color mapped PNG. Disabled by -DPNG_NO_GET_PALETTE_MAX # # All of this stuff can be removed by "option PALETTE_MAX off" but using # -DPNG_NO_ defines on the command line just sets the relevant option to diff --git a/scripts/pnglibconf.h.prebuilt b/scripts/pnglibconf.h.prebuilt index 122f1bde6..2caf413e1 100644 --- a/scripts/pnglibconf.h.prebuilt +++ b/scripts/pnglibconf.h.prebuilt @@ -2,7 +2,7 @@ /* pnglibconf.h - library build configuration */ -/* Libpng version 1.7.0beta69 - November 13, 2015 */ +/* Libpng version 1.7.0beta69 - November 23, 2015 */ /* Copyright (c) 1998-2015 Glenn Randers-Pehrson */ @@ -137,6 +137,7 @@ #define PNG_WRITE_FILTER_SUPPORTED #define PNG_WRITE_FLUSH_SUPPORTED #define PNG_WRITE_GET_PALETTE_MAX_SUPPORTED +#define PNG_WRITE_INTERLACE_SUPPORTED #define PNG_WRITE_INTERLACING_SUPPORTED #define PNG_WRITE_INT_FUNCTIONS_SUPPORTED #define PNG_WRITE_INVERT_ALPHA_SUPPORTED From e51652b4db0e5922d3997e676aa90ae8ff8cbeeb Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sun, 22 Nov 2015 22:41:10 -0600 Subject: [PATCH 2/2] [libpng17] Reverted 12 -> 12U again. --- pngrutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pngrutil.c b/pngrutil.c index 85b6d73df..0d3c549ca 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -1948,7 +1948,7 @@ png_handle_pCAL(png_structrp png_ptr, png_inforp info_ptr) /* We need to have at least 12 bytes after the purpose string * in order to get the parameter information. */ - if (endptr - buf <= 12U) + if (endptr - buf <= 12) { png_chunk_benign_error(png_ptr, "invalid"); return;