From 3645008e229306081b68da9689561f4f02a482d7 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Mon, 9 Mar 2015 09:13:58 -0500 Subject: [PATCH] [libpng16] Free the unknown_chunks structure even when it contains no data. --- ANNOUNCE | 5 +++-- CHANGES | 3 ++- libpng-manual.txt | 12 ++++++++---- libpng.3 | 20 ++++++++++++-------- png.c | 38 ++++++++++++++++---------------------- 5 files changed, 41 insertions(+), 37 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index eb7e6fd61..d26e49f11 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,4 +1,4 @@ -Libpng 1.6.17rc02 - March 8, 2015 +Libpng 1.6.17rc02 - March 9, 2015 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. @@ -68,9 +68,10 @@ Version 1.6.17beta06 [February 27, 2015] Version 1.6.17rc01 [March 4, 2015] No changes. -Version 1.6.17rc02 [March 8, 2015] +Version 1.6.17rc02 [March 9, 2015] Removed some comments that the configure script did not handle properly from scripts/pnglibconf.dfa and pnglibconf.h.prebuilt. + Free the unknown_chunks structure even when it contains no data. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index f0b04a19b..076c28c3c 100644 --- a/CHANGES +++ b/CHANGES @@ -5169,9 +5169,10 @@ Version 1.6.17beta06 [February 27, 2015] Version 1.6.17rc01 [March 4, 2015] No changes. -Version 1.6.17rc02 [March 8, 2015] +Version 1.6.17rc02 [March 9, 2015] Removed some comments that the configure script did not handle properly from scripts/pnglibconf.dfa and pnglibconf.h.prebuilt. + Free the unknown_chunks structure even when it contains no data. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/libpng-manual.txt b/libpng-manual.txt index d658759ae..ffdeb143f 100644 --- a/libpng-manual.txt +++ b/libpng-manual.txt @@ -1,6 +1,6 @@ libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.17rc02 - March 7, 2015 + libpng version 1.6.17rc02 - March 9, 2015 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2015 Glenn Randers-Pehrson @@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.6.17rc02 - March 7, 2015 + libpng versions 0.97, January 1998, through 1.6.17rc02 - March 9, 2015 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2015 Glenn Randers-Pehrson @@ -1994,7 +1994,7 @@ value when you call it in this position: png_set_gamma(png_ptr, screen_gamma, 0.45455); If you need to reduce an RGB file to a paletted file, or if a paletted -file has more entries then will fit on your screen, png_set_quantize() +file has more entries than will fit on your screen, png_set_quantize() will do that. Note that this is a simple match quantization that merely finds the closest color available. This should work fairly well with optimized palettes, but fairly badly with linear color cubes. If you @@ -5032,6 +5032,10 @@ The signatures of many exported functions were changed, such that png_infop became png_inforp or png_const_inforp where "rp" indicates a "restricted pointer". +The support for FAR/far types has been eliminated and the definition of +png_alloc_size_t is now controlled by a flag so that 'small size_t' systems +can select it if necessary. + Error detection in some chunks has improved; in particular the iCCP chunk reader now does pretty complete validation of the basic format. Some bad profiles that were previously accepted are now accepted with a warning or @@ -5275,7 +5279,7 @@ Other rules can be inferred by inspecting the libpng source. XVI. Y2K Compliance in libpng -March 7, 2015 +March 9, 2015 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. diff --git a/libpng.3 b/libpng.3 index 058e81c27..85307396a 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,4 +1,4 @@ -.TH LIBPNG 3 "March 7, 2015" +.TH LIBPNG 3 "March 9, 2015" .SH NAME libpng \- Portable Network Graphics (PNG) Reference Library 1.6.17rc02 .SH SYNOPSIS @@ -504,7 +504,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng. .SH LIBPNG.TXT libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.17rc02 - March 7, 2015 + libpng version 1.6.17rc02 - March 9, 2015 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2015 Glenn Randers-Pehrson @@ -515,7 +515,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.6.17rc02 - March 7, 2015 + libpng versions 0.97, January 1998, through 1.6.17rc02 - March 9, 2015 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2015 Glenn Randers-Pehrson @@ -2498,7 +2498,7 @@ value when you call it in this position: png_set_gamma(png_ptr, screen_gamma, 0.45455); If you need to reduce an RGB file to a paletted file, or if a paletted -file has more entries then will fit on your screen, png_set_quantize() +file has more entries than will fit on your screen, png_set_quantize() will do that. Note that this is a simple match quantization that merely finds the closest color available. This should work fairly well with optimized palettes, but fairly badly with linear color cubes. If you @@ -5536,6 +5536,10 @@ The signatures of many exported functions were changed, such that png_infop became png_inforp or png_const_inforp where "rp" indicates a "restricted pointer". +The support for FAR/far types has been eliminated and the definition of +png_alloc_size_t is now controlled by a flag so that 'small size_t' systems +can select it if necessary. + Error detection in some chunks has improved; in particular the iCCP chunk reader now does pretty complete validation of the basic format. Some bad profiles that were previously accepted are now accepted with a warning or @@ -5779,7 +5783,7 @@ Other rules can be inferred by inspecting the libpng source. .SH XVI. Y2K Compliance in libpng -March 7, 2015 +March 9, 2015 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. @@ -6095,7 +6099,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.6.17rc02 - March 7, 2015: +Libpng version 1.6.17rc02 - March 9, 2015: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). @@ -6118,7 +6122,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.2.6, August 15, 2004, through 1.6.17rc02, March 7, 2015, are +libpng versions 1.2.6, August 15, 2004, through 1.6.17rc02, March 9, 2015, are Copyright (c) 2004,2006-2014 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.2.5 with the following individual added to the list of Contributing Authors @@ -6217,7 +6221,7 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson glennrp at users.sourceforge.net -March 7, 2015 +March 9, 2015 .\" end of man page diff --git a/png.c b/png.c index 0889763fb..396e90534 100644 --- a/png.c +++ b/png.c @@ -547,20 +547,17 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, else { - if (info_ptr->splt_palettes_num != 0) + int i; + + for (i = 0; i < info_ptr->splt_palettes_num; i++) { - int i; - - for (i = 0; i < info_ptr->splt_palettes_num; i++) - { - png_free(png_ptr, info_ptr->splt_palettes[i].name); - png_free(png_ptr, info_ptr->splt_palettes[i].entries); - } - - png_free(png_ptr, info_ptr->splt_palettes); - info_ptr->splt_palettes = NULL; - info_ptr->splt_palettes_num = 0; + png_free(png_ptr, info_ptr->splt_palettes[i].name); + png_free(png_ptr, info_ptr->splt_palettes[i].entries); } + + png_free(png_ptr, info_ptr->splt_palettes); + info_ptr->splt_palettes = NULL; + info_ptr->splt_palettes_num = 0; info_ptr->valid &= ~PNG_INFO_sPLT; } } @@ -580,15 +577,12 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, { int i; - if (info_ptr->unknown_chunks_num != 0) - { - for (i = 0; i < info_ptr->unknown_chunks_num; i++) - png_free(png_ptr, info_ptr->unknown_chunks[i].data); + for (i = 0; i < info_ptr->unknown_chunks_num; i++) + png_free(png_ptr, info_ptr->unknown_chunks[i].data); - png_free(png_ptr, info_ptr->unknown_chunks); - info_ptr->unknown_chunks = NULL; - info_ptr->unknown_chunks_num = 0; - } + png_free(png_ptr, info_ptr->unknown_chunks); + info_ptr->unknown_chunks = NULL; + info_ptr->unknown_chunks_num = 0; } } #endif @@ -772,13 +766,13 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.17rc02 - March 7, 2015" PNG_STRING_NEWLINE \ + "libpng version 1.6.17rc02 - March 9, 2015" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.6.17rc02 - March 7, 2015\ + return "libpng version 1.6.17rc02 - March 9, 2015\ Copyright (c) 1998-2015 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";