From c5dc456afdae30153e48941954028ffaeb84d8df Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Wed, 1 Oct 2014 10:29:26 -0500 Subject: [PATCH] [libpng16] Redid recent changes to pnglibconf.h that were reverted. --- scripts/pnglibconf.dfa | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/scripts/pnglibconf.dfa b/scripts/pnglibconf.dfa index bb22fb1e7..152eeaab2 100644 --- a/scripts/pnglibconf.dfa +++ b/scripts/pnglibconf.dfa @@ -8,7 +8,7 @@ com pnglibconf.h - library build configuration com version com -com Copyright (c) 1998-2012 Glenn Randers-Pehrson +com Copyright (c) 1998-2014 Glenn Randers-Pehrson com com This code is released under the libpng license. com For conditions of distribution and use, see the disclaimer @@ -114,6 +114,13 @@ file pnglibconf.h scripts/pnglibconf.dfa PNGLCONF_H logunsupported = 1 +# The following allows the output from configure to modify the contents of +# pnglibconf.h + +@#ifdef HAVE_CONFIG_H +@# include "config.h" +@#endif + # PNG_USER_CONFIG has to be defined on the compiler command line # to cause pngusr.h to be read while constructing pnglibconf.h # @@ -189,10 +196,6 @@ setting API_RULE default 0 setting PREFIX -# Default to using the read macros - -setting DEFAULT_READ_MACROS default 1 - # Implementation specific control of the optimizations, enabled by those # hardware or software options that need it (typically when run-time choices # must be made by the user) @@ -227,19 +230,21 @@ option ARM_NEON_CHECK disabled requires ALIGNED_MEMORY, sets ARM_NEON_OPT 1 # These settings configure the default compression level (0-9) and 'strategy'; -# strategy is as defined by the implementors of zlib, it describes the input +# strategy is as defined by the implementors of zlib. It describes the input # data and modifies the zlib parameters in an attempt to optimize the balance # between search and huffman encoding in the zlib algorithms. The defaults are # the zlib.h defaults - the apparently recursive definition does not arise # because the name of the setting is prefixed by PNG_ # # The TEXT values are the defaults when writing compressed text (all forms) -# -# Include the zlib header too, so that the defaults below are known + +# Include the zlib header so that the defaults below are known @# include # The '@' here means to substitute the value when pnglibconf.h is built setting Z_DEFAULT_COMPRESSION default @Z_DEFAULT_COMPRESSION +# TODO: why aren't these Z_RLE; zlib.h says that Z_RLE, specifically, is +# appropriate for PNG images, maybe it doesn't exist in all versions? setting Z_DEFAULT_STRATEGY default @Z_FILTERED setting Z_DEFAULT_NOFILTER_STRATEGY default @Z_DEFAULT_STRATEGY setting ZLIB_VERNUM default @ZLIB_VERNUM @@ -247,6 +252,10 @@ setting ZLIB_VERNUM default @ZLIB_VERNUM setting TEXT_Z_DEFAULT_COMPRESSION default @Z_DEFAULT_COMPRESSION setting TEXT_Z_DEFAULT_STRATEGY default @Z_DEFAULT_STRATEGY +# Default to using the read macros + +setting DEFAULT_READ_MACROS default 1 + # The alternative is to call functions to read PNG values, if # the functions are turned *off* the read macros must always # be enabled, so turning this off will actually force the @@ -370,7 +379,16 @@ option SET_USER_LIMITS enables SET_CHUNK_MALLOC_LIMIT # # If these settings are *not* set libpng will not limit the size of # images or the size of data in ancilliary chunks. This does lead to -# security issues if PNG files come from untrusted sources. +# security issues if PNG files come from untrusted sources. Settings have the +# following interpretations: +# +# USER_WIDTH_MAX: maximum width of an image that will be read +# USER_HEIGHT_MAX: maximum height +# USER_CHUNK_MALLOC_MAX: maximum in-memory (decompressed) size of a single chunk +# USER_CHUNK_CACHE_MAX: maximum number of chunks to be cached +# +# Only chunks that are variable in number are counted towards the +# USER_CHUNK_CACHE_MAX limit setting USER_WIDTH_MAX setting USER_HEIGHT_MAX setting USER_CHUNK_CACHE_MAX