[devel] Apply png_user_chunk_cache_max within png_decompress_chunk()

and merged libpng-1.2.41.txt with libpng-1.4.0.txt where appropriate.
This commit is contained in:
Glenn Randers-Pehrson 2009-10-31 19:37:05 -05:00
parent 8fe28948ca
commit ef29a5e827
7 changed files with 51 additions and 17 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.4.0beta89 - October 31, 2009 Libpng 1.4.0beta89 - November 1, 2009
This is not intended to be a public release. It will be replaced 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. within a few weeks by a public version or by another test version.
@ -588,9 +588,11 @@ version 1.4.0beta88 [October 30, 2009]
Revised libpng*.txt section about differences between 1.2.x and 1.4.0 Revised libpng*.txt section about differences between 1.2.x and 1.4.0
because most of the new features have now been ported back to 1.2.41 because most of the new features have now been ported back to 1.2.41
version 1.4.0beta89 [October 31, 2009] version 1.4.0beta89 [November 1, 2009]
More bugfixes and improvements to CMakeLists.txt (Philip Lowman) More bugfixes and improvements to CMakeLists.txt (Philip Lowman)
Removed a harmless extra png_set_invert_alpha() from pngwrite.c Removed a harmless extra png_set_invert_alpha() from pngwrite.c
Apply png_user_chunk_cache_max within png_decompress_chunk().
Merged libpng-1.2.41.txt with libpng-1.4.0.txt where appropriate.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -2274,9 +2274,11 @@ version 1.4.0beta88 [October 30, 2009]
Revised libpng*.txt section about differences between 1.2.x and 1.4.0 Revised libpng*.txt section about differences between 1.2.x and 1.4.0
because most of the new features have now been ported back to 1.2.41 because most of the new features have now been ported back to 1.2.41
version 1.4.0beta89 [October 31, 2009] version 1.4.0beta89 [November 1, 2009]
More bugfixes and improvements to CMakeLists.txt (Philip Lowman) More bugfixes and improvements to CMakeLists.txt (Philip Lowman)
Removed a harmless extra png_set_invert_alpha() from pngwrite.c Removed a harmless extra png_set_invert_alpha() from pngwrite.c
Apply png_user_chunk_cache_max within png_decompress_chunk().
Merged libpng-1.2.41.txt with libpng-1.4.0.txt where appropriate.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng libpng.txt - A description on how to use and modify libpng
libpng version 1.4.0beta89 - October 30, 2009 libpng version 1.4.0beta89 - November 1, 2009
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2009 Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson
@ -11,7 +11,7 @@ libpng.txt - A description on how to use and modify libpng
Based on: Based on:
libpng versions 0.97, January 1998, through 1.4.0beta89 - October 30, 2009 libpng versions 0.97, January 1998, through 1.4.0beta89 - November 1, 2009
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2009 Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson
@ -420,6 +420,9 @@ where 0x7fffffffL means unlimited. You can retrieve this limit with
chunk_cache_max = png_get_chunk_cache_max(png_ptr); chunk_cache_max = png_get_chunk_cache_max(png_ptr);
This limit also applies to the number of buffers that can be allocated
by png_decompress_chunk().
The high-level read interface The high-level read interface
At this point there are two ways to proceed; through the high-level At this point there are two ways to proceed; through the high-level
@ -692,6 +695,10 @@ into the info_ptr is returned for any complex types.
string for unknown). string for unknown).
text_ptr[i].lang_key - keyword in UTF-8 text_ptr[i].lang_key - keyword in UTF-8
(empty string for unknown). (empty string for unknown).
Note that the itxt_length, lang, and lang_key
members of the text_ptr structure only exist
when the library is built with iTXt chunk support.
num_text - number of comments (same as num_text - number of comments (same as
num_comments; you can put NULL here num_comments; you can put NULL here
to avoid the duplication) to avoid the duplication)
@ -1931,6 +1938,10 @@ width, height, bit_depth, and color_type must be the same in each call.
empty for unknown). empty for unknown).
text_ptr[i].translated_keyword - keyword in UTF-8 (NULL text_ptr[i].translated_keyword - keyword in UTF-8 (NULL
or empty for unknown). or empty for unknown).
Note that the itxt_length, lang, and lang_key
members of the text_ptr structure only exist
when the library is built with iTXt chunk support.
num_text - number of comments num_text - number of comments
png_set_sPLT(png_ptr, info_ptr, &palette_ptr, png_set_sPLT(png_ptr, info_ptr, &palette_ptr,
@ -3214,7 +3225,7 @@ source.
XIII. Y2K Compliance in libpng XIII. Y2K Compliance in libpng
October 30, 2009 November 1, 2009
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.

View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* Last changed in libpng 1.4.0 [October 30, 2009] * Last changed in libpng 1.4.0 [November 1, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -65,8 +65,10 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
/* Added at libpng-1.2.6 */ /* Added at libpng-1.2.6 */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED #ifdef PNG_SET_USER_LIMITS_SUPPORTED
png_ptr->user_width_max=PNG_USER_WIDTH_MAX; png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
/* Added at libpng-1.2.41 */
png_ptr->user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
#endif #endif
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED

View File

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file /* pngrutil.c - utilities to read a PNG file
* *
* Last changed in libpng 1.4.0 [October 30, 2009] * Last changed in libpng 1.4.0 [November 1, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -286,9 +286,23 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
png_charp tmp; png_charp tmp;
tmp = text; tmp = text;
text = (png_charp)png_malloc_warn(png_ptr, #ifdef PNG_SET_USER_LIMITS_SUPPORTED
(png_size_t)(text_size + if ((png_ptr->user_chunk_cache_max != 0) &&
png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1)); (--png_ptr->user_chunk_cache_max == 0))
{
png_warning(png_ptr, "No space in chunk cache");
text = NULL;
}
else
{
#endif
text = (png_charp)png_malloc_warn(png_ptr,
(png_size_t)(text_size +
png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1));
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
}
#endif
if (text == NULL) if (text == NULL)
{ {
png_free(png_ptr, tmp); png_free(png_ptr, tmp);

View File

@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct /* pngset.c - storage of image information into info struct
* *
* Last changed in libpng 1.4.0 [October 30, 2009] * Last changed in libpng 1.4.0 [November 1, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -696,6 +696,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
lang_len = 0; lang_len = 0;
lang_key_len = 0; lang_key_len = 0;
} }
else else
#ifdef PNG_iTXt_SUPPORTED #ifdef PNG_iTXt_SUPPORTED
{ {
@ -709,6 +710,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
else else
lang_key_len = 0; lang_key_len = 0;
} }
#else #else
{ {
png_warning(png_ptr, "iTXt chunk not supported"); png_warning(png_ptr, "iTXt chunk not supported");
@ -726,6 +728,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
#endif #endif
textp->compression = PNG_TEXT_COMPRESSION_NONE; textp->compression = PNG_TEXT_COMPRESSION_NONE;
} }
else else
{ {
text_length = png_strlen(text_ptr[i].text); text_length = png_strlen(text_ptr[i].text);
@ -777,6 +780,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
} }
else else
#endif #endif
{ {
textp->text_length = text_length; textp->text_length = text_length;
#ifdef PNG_iTXt_SUPPORTED #ifdef PNG_iTXt_SUPPORTED
@ -817,8 +821,7 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
if (trans_alpha != NULL) if (trans_alpha != NULL)
{ {
/* /* It may not actually be necessary to set png_ptr->trans_alpha here;
* It may not actually be necessary to set png_ptr->trans_alpha here;
* we do it for backward compatibility with the way the png_handle_tRNS * we do it for backward compatibility with the way the png_handle_tRNS
* function used to do the allocation. * function used to do the allocation.
*/ */

View File

@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file /* pngwrite.c - general routines to write a PNG file
* *
* Last changed in libpng 1.4.0 [October 31, 2009] * Last changed in libpng 1.4.0 [November 1, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)