[devel] Revise the "#ifdef" blocks in png_inflate()

so it will compile when neither PNG_USER_CHUNK_MALLOC_MAX nor
PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED is defined.
This commit is contained in:
Glenn Randers-Pehrson 2010-03-09 07:52:30 -06:00
parent 3919f23a69
commit afa999d446
3 changed files with 13 additions and 0 deletions

View File

@ -86,6 +86,9 @@ version 1.5.0beta12 [March 9, 2010]
version 1.5.0beta13 [March 9, 2010]
Protect pngstruct.h, pnginfo.h, and pngdebug.h from being included twice.
Revise the "#ifdef" blocks in png_inflate() so it will compile when neither
PNG_USER_CHUNK_MALLOC_MAX nor PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
is defined.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -2563,6 +2563,9 @@ version 1.5.0beta12 [March 9, 2010]
version 1.5.0beta13 [March 9, 2010]
Protect pngstruct.h, pnginfo.h, and pngdebug.h from being included twice.
Revise the "#ifdef" blocks in png_inflate() so it will compile when neither
PNG_USER_CHUNK_MALLOC_MAX nor PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
is defined.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -325,8 +325,10 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
if (png_ptr->user_chunk_malloc_max &&
(prefix_size + expanded_size >= png_ptr->user_chunk_malloc_max - 1))
#else
# ifdef PNG_USER_CHUNK_MALLOC_MAX
if ((PNG_USER_CHUNK_MALLOC_MAX > 0) &&
prefix_size + expanded_size >= PNG_USER_CHUNK_MALLOC_MAX - 1)
# endif
#endif
png_warning(png_ptr, "Exceeded size limit while expanding chunk");
@ -335,7 +337,12 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
* and we have nothing to do - the code will exit through the
* error case below.
*/
#if defined(PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED) || \
defined(PNG_USER_CHUNK_MALLOC_MAX)
else if (expanded_size > 0)
#else
if (expanded_size > 0)
#endif
{
/* Success (maybe) - really uncompress the chunk. */
png_size_t new_size = 0;