From afa999d4460c02473d521e58a0f314dfd35526a0 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Tue, 9 Mar 2010 07:52:30 -0600 Subject: [PATCH] [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. --- ANNOUNCE | 3 +++ CHANGES | 3 +++ pngrutil.c | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/ANNOUNCE b/ANNOUNCE index f71624e00..424eb1612 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -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 diff --git a/CHANGES b/CHANGES index 771a35174..e00230324 100644 --- a/CHANGES +++ b/CHANGES @@ -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 diff --git a/pngrutil.c b/pngrutil.c index 2506d58fe..3f891bdc8 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -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;