[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.
diff --git a/ANNOUNCE b/ANNOUNCE
index 165d20d..b811ddb 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -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
within a few weeks by a public version or by another test version.
@@ -588,9 +588,11 @@
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
-version 1.4.0beta89 [October 31, 2009]
+version 1.4.0beta89 [November 1, 2009]
More bugfixes and improvements to CMakeLists.txt (Philip Lowman)
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
(subscription required; visit
diff --git a/CHANGES b/CHANGES
index 3090a74..141a0e3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2274,9 +2274,11 @@
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
-version 1.4.0beta89 [October 31, 2009]
+version 1.4.0beta89 [November 1, 2009]
More bugfixes and improvements to CMakeLists.txt (Philip Lowman)
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
(subscription required; visit
diff --git a/libpng-1.4.0beta89.txt b/libpng-1.4.0beta89.txt
index 1e6ab6a..066fded 100644
--- a/libpng-1.4.0beta89.txt
+++ b/libpng-1.4.0beta89.txt
@@ -1,6 +1,6 @@
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
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@@ -11,7 +11,7 @@
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
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@@ -420,6 +420,9 @@
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
At this point there are two ways to proceed; through the high-level
@@ -692,6 +695,10 @@
string for unknown).
text_ptr[i].lang_key - keyword in UTF-8
(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_comments; you can put NULL here
to avoid the duplication)
@@ -1931,6 +1938,10 @@
empty for unknown).
text_ptr[i].translated_keyword - keyword in UTF-8 (NULL
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
png_set_sPLT(png_ptr, info_ptr, &palette_ptr,
@@ -3214,7 +3225,7 @@
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
an official declaration.
diff --git a/pngread.c b/pngread.c
index 522e689..75953d0 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,7 +1,7 @@
/* 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
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -65,8 +65,10 @@
/* Added at libpng-1.2.6 */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
- png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
- png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
+ png_ptr->user_width_max = PNG_USER_WIDTH_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
#ifdef PNG_SETJMP_SUPPORTED
diff --git a/pngrutil.c b/pngrutil.c
index 0ed836d..6fb99a5 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,7 +1,7 @@
/* 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
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -286,9 +286,23 @@
png_charp tmp;
tmp = text;
- 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
+ if ((png_ptr->user_chunk_cache_max != 0) &&
+ (--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)
{
png_free(png_ptr, tmp);
diff --git a/pngset.c b/pngset.c
index 9782d67..7a1d512 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1,7 +1,7 @@
/* 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
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -696,6 +696,7 @@
lang_len = 0;
lang_key_len = 0;
}
+
else
#ifdef PNG_iTXt_SUPPORTED
{
@@ -709,6 +710,7 @@
else
lang_key_len = 0;
}
+
#else
{
png_warning(png_ptr, "iTXt chunk not supported");
@@ -726,6 +728,7 @@
#endif
textp->compression = PNG_TEXT_COMPRESSION_NONE;
}
+
else
{
text_length = png_strlen(text_ptr[i].text);
@@ -777,6 +780,7 @@
}
else
#endif
+
{
textp->text_length = text_length;
#ifdef PNG_iTXt_SUPPORTED
@@ -817,8 +821,7 @@
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
* function used to do the allocation.
*/
diff --git a/pngwrite.c b/pngwrite.c
index e1eb9fc..fc1bee7 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,7 +1,7 @@
/* 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
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)