From 92ef42d5e12dfa77f938992d7b9338bcc4d918b1 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Mon, 16 Feb 2015 22:46:16 -0600 Subject: [PATCH] [libpng17] Display user limits in the output from pngtest. --- ANNOUNCE | 10 ++++++++-- CHANGES | 8 +++++++- pngtest.c | 24 ++++++++++++++++++++++-- pngusr.dfa | 2 +- scripts/pnglibconf.dfa | 2 +- scripts/pnglibconf.h.prebuilt | 4 ++-- 6 files changed, 41 insertions(+), 9 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 0d4f708f0..7f312040f 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.7.0beta51 - February 15, 2015 +Libpng 1.7.0beta51 - February 17, 2015 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. @@ -714,7 +714,13 @@ Version 1.7.0beta50 [February 15, 2015] being tested, a second tst_row buffer. This improves CPU speed over that achieved by libpng-1.7.0beta49. -Version 1.7.0beta51 [February 15, 2015] +Version 1.7.0beta51 [February 17, 2015] + Combined similar parts of png_write_find_filter() into a png_increase_lmins() + function. + Display user limits in the output from pngtest. + Replaced test for harmless integer overflow (wraparound) in pngwutil.c + with a method that prevents overflow and does not increase cpu usage + significantly. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index d3835d604..83efa0195 100644 --- a/CHANGES +++ b/CHANGES @@ -5003,7 +5003,13 @@ Version 1.7.0beta50 [February 15, 2015] being tested, a second tst_row buffer. This improves CPU speed over that achieved by libpng-1.7.0beta49. -Version 1.7.0beta51 [February 15, 2015] +Version 1.7.0beta51 [February 17, 2015] + Combined similar parts of png_write_find_filter() into a png_increase_lmins() + function. + Display user limits in the output from pngtest. + Replaced test for harmless integer overflow (wraparound) in pngwutil.c + with a method that prevents overflow and does not increase cpu usage + significantly. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngtest.c b/pngtest.c index baadced66..d80895e63 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1,8 +1,8 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.6.15 [November 20, 2014] - * Copyright (c) 1998-2014 Glenn Randers-Pehrson + * Last changed in libpng 1.6.17 [(PENDING RELEASE)] + * Copyright (c) 1998-2015 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.) * @@ -1701,6 +1701,8 @@ main(int argc, char *argv[]) int multiple = 0; int ierror = 0; + png_structp dummy_ptr; + fprintf(STDERR, "\n Testing libpng version %s\n", PNG_LIBPNG_VER_STRING); fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION); fprintf(STDERR, "%s", png_get_copyright(NULL)); @@ -1994,6 +1996,24 @@ main(int argc, char *argv[]) else fprintf(STDERR, " libpng FAILS test\n"); + dummy_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + fprintf(STDERR, " Default limits:\n"); + fprintf(STDERR, " width_max = %lu\n", + (unsigned long) png_get_user_width_max(dummy_ptr)); + fprintf(STDERR, " height_max = %lu\n", + (unsigned long) png_get_user_height_max(dummy_ptr)); + if (png_get_chunk_cache_max(dummy_ptr) == 0) + fprintf(STDERR, " cache_max = unlimited\n"); + else + fprintf(STDERR, " cache_max = %lu\n", + (unsigned long) png_get_chunk_cache_max(dummy_ptr)); + if (png_get_chunk_malloc_max(dummy_ptr) == 0) + fprintf(STDERR, " malloc_max = unlimited\n"); + else + fprintf(STDERR, " malloc_max = %lu\n", + (unsigned long) png_get_chunk_malloc_max(dummy_ptr)); + png_destroy_read_struct(&dummy_ptr, NULL, NULL); + return (int)(ierror != 0); } #else diff --git a/pngusr.dfa b/pngusr.dfa index d68d5d169..1cb32b1c5 100644 --- a/pngusr.dfa +++ b/pngusr.dfa @@ -12,4 +12,4 @@ # @# define PNG_USER_WIDTH_MAX 65535 # @# define PNG_USER_HEIGHT_MAX 65535 # @# define PNG_USER_CHUNK_CACHE_MAX 256 -# @# define PNG_USER_CHUNK_MALLOC_MAX 1000000 +# @# define PNG_USER_CHUNK_MALLOC_MAX 640000 diff --git a/scripts/pnglibconf.dfa b/scripts/pnglibconf.dfa index 027a8b561..005b52b27 100644 --- a/scripts/pnglibconf.dfa +++ b/scripts/pnglibconf.dfa @@ -395,7 +395,7 @@ option USER_LIMITS requires READ # USER_CHUNK_CACHE_MAX limit setting USER_WIDTH_MAX default 1000000 /* Use 0x7fffffff for unlimited */ setting USER_HEIGHT_MAX default 1000000 /* Use 0x7fffffff for unlimited */ -setting USER_CHUNK_CACHE_MAX default 128 /* Use 0 for unlimited */ +setting USER_CHUNK_CACHE_MAX default 1000 /* Use 0 for unlimited */ setting USER_CHUNK_MALLOC_MAX default 8000000 /* Use 0 for unlimited */ # If this option is enabled APIs to set the above limits at run time are added; diff --git a/scripts/pnglibconf.h.prebuilt b/scripts/pnglibconf.h.prebuilt index 61c3e02aa..c46e78632 100644 --- a/scripts/pnglibconf.h.prebuilt +++ b/scripts/pnglibconf.h.prebuilt @@ -2,7 +2,7 @@ /* pnglibconf.h - library build configuration */ -/* Libpng version 1.7.0beta51 - February 15, 2015 */ +/* Libpng version 1.7.0beta51 - February 17, 2015 */ /* Copyright (c) 1998-2014 Glenn Randers-Pehrson */ @@ -197,7 +197,7 @@ #define PNG_QUANTIZE_RED_BITS 5 #define PNG_TEXT_Z_DEFAULT_COMPRESSION (-1) #define PNG_TEXT_Z_DEFAULT_STRATEGY 0 -#define PNG_USER_CHUNK_CACHE_MAX 128 /* Use 0 for unlimited */ +#define PNG_USER_CHUNK_CACHE_MAX 1000 /* Use 0 for unlimited */ #define PNG_USER_CHUNK_MALLOC_MAX 8000000 /* Use 0 for unlimited */ #define PNG_USER_HEIGHT_MAX 1000000 /* Use 0x7fffffff for unlimited */ #define PNG_USER_WIDTH_MAX 1000000 /* Use 0x7fffffff for unlimited */