[libpng16]Allow calling png_get_IHDR() with NULL arguments (Reuben Hawkins).

This commit is contained in:
Glenn Randers-Pehrson 2015-02-18 12:24:46 -06:00
parent d3ff44f0d5
commit 60a7506744
5 changed files with 36 additions and 28 deletions

View File

@ -53,6 +53,7 @@ Version 1.6.17beta03 [February 17, 2015]
Version 1.6.17beta04 [February 18, 2015] Version 1.6.17beta04 [February 18, 2015]
Added PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED macro, on by default. Added PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED macro, on by default.
Allow user to call png_get_IHDR() with NULL arguments (Reuben Hawkins).
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

@ -5154,6 +5154,7 @@ Version 1.6.17beta03 [February 17, 2015]
Version 1.6.17beta04 [February 18, 2015] Version 1.6.17beta04 [February 18, 2015]
Added PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED macro, on by default. Added PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED macro, on by default.
Allow user to call png_get_IHDR() with NULL arguments (Reuben Hawkins).
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-manual.txt - A description on how to use and modify libpng libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.6.17beta04 - February 17, 2015 libpng version 1.6.17beta04 - February 18, 2015
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-2015 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: Based on:
libpng versions 0.97, January 1998, through 1.6.17beta04 - February 17, 2015 libpng versions 0.97, January 1998, through 1.6.17beta04 - February 18, 2015
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2015 Glenn Randers-Pehrson Copyright (c) 1998-2015 Glenn Randers-Pehrson
@ -1265,13 +1265,13 @@ in until png_read_end() has read the chunk data following the image.
the PNG datastream is embedded in the PNG datastream is embedded in
a MNG-1.0 datastream) a MNG-1.0 datastream)
Any or all of interlace_type, compression_type, or Any of width, height, color_type, bit_depth,
filter_method can be NULL if you are interlace_type, compression_type, or filter_method can
not interested in their values. be NULL if you are not interested in their values.
Note that png_get_IHDR() returns 32-bit data into Note that png_get_IHDR() returns 32-bit data into
the application's width and height variables. the application's width and height variables.
This is an unsafe situation if these are 16-bit This is an unsafe situation if these are not png_uint_32
variables. In such situations, the variables. In such situations, the
png_get_image_width() and png_get_image_height() png_get_image_width() and png_get_image_height()
functions described below are safer. functions described below are safer.
@ -5046,7 +5046,7 @@ means of
PNG_OPTION_ON); PNG_OPTION_ON);
#endif #endif
It's not a good idea to do this if you are using the new "simplified API", It's not a good idea to do this if you are using the "simplified API",
which needs to be able to recognize sRGB profiles conveyed via the iCCP which needs to be able to recognize sRGB profiles conveyed via the iCCP
chunk. chunk.
@ -5275,7 +5275,7 @@ Other rules can be inferred by inspecting the libpng source.
XVI. Y2K Compliance in libpng XVI. Y2K Compliance in libpng
February 17, 2015 February 18, 2015
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,4 +1,4 @@
.TH LIBPNG 3 "February 17, 2015" .TH LIBPNG 3 "February 18, 2015"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.17beta04 libpng \- Portable Network Graphics (PNG) Reference Library 1.6.17beta04
.SH SYNOPSIS .SH SYNOPSIS
@ -504,7 +504,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
.SH LIBPNG.TXT .SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.6.17beta04 - February 17, 2015 libpng version 1.6.17beta04 - February 18, 2015
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-2015 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: Based on:
libpng versions 0.97, January 1998, through 1.6.17beta04 - February 17, 2015 libpng versions 0.97, January 1998, through 1.6.17beta04 - February 18, 2015
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2015 Glenn Randers-Pehrson Copyright (c) 1998-2015 Glenn Randers-Pehrson
@ -1769,13 +1769,13 @@ in until png_read_end() has read the chunk data following the image.
the PNG datastream is embedded in the PNG datastream is embedded in
a MNG-1.0 datastream) a MNG-1.0 datastream)
Any or all of interlace_type, compression_type, or Any of width, height, color_type, bit_depth,
filter_method can be NULL if you are interlace_type, compression_type, or filter_method can
not interested in their values. be NULL if you are not interested in their values.
Note that png_get_IHDR() returns 32-bit data into Note that png_get_IHDR() returns 32-bit data into
the application's width and height variables. the application's width and height variables.
This is an unsafe situation if these are 16-bit This is an unsafe situation if these are not png_uint_32
variables. In such situations, the variables. In such situations, the
png_get_image_width() and png_get_image_height() png_get_image_width() and png_get_image_height()
functions described below are safer. functions described below are safer.
@ -5550,7 +5550,7 @@ means of
PNG_OPTION_ON); PNG_OPTION_ON);
#endif #endif
It's not a good idea to do this if you are using the new "simplified API", It's not a good idea to do this if you are using the "simplified API",
which needs to be able to recognize sRGB profiles conveyed via the iCCP which needs to be able to recognize sRGB profiles conveyed via the iCCP
chunk. chunk.
@ -5779,7 +5779,7 @@ Other rules can be inferred by inspecting the libpng source.
.SH XVI. Y2K Compliance in libpng .SH XVI. Y2K Compliance in libpng
February 17, 2015 February 18, 2015
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.
@ -6094,7 +6094,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation. Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.6.17beta04 - February 17, 2015: Libpng version 1.6.17beta04 - February 18, 2015:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@ -6117,7 +6117,7 @@ this sentence.
This code is released under the libpng license. This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.6.17beta04, February 17, 2015, are libpng versions 1.2.6, August 15, 2004, through 1.6.17beta04, February 18, 2015, are
Copyright (c) 2004,2006-2014 Glenn Randers-Pehrson, and are Copyright (c) 2004,2006-2014 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors with the following individual added to the list of Contributing Authors
@ -6216,7 +6216,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
February 17, 2015 February 18, 2015
.\" end of man page .\" end of man page

View File

@ -1,8 +1,8 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* Last changed in libpng 1.6.15 [November 20, 2014] * Last changed in libpng 1.6.17 [(PENDING RELEASE)]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2015 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.)
* *
@ -799,13 +799,19 @@ png_get_IHDR(png_const_structrp png_ptr, png_const_inforp info_ptr,
{ {
png_debug1(1, "in %s retrieval function", "IHDR"); png_debug1(1, "in %s retrieval function", "IHDR");
if (png_ptr == NULL || info_ptr == NULL || width == NULL || if (png_ptr == NULL || info_ptr == NULL)
height == NULL || bit_depth == NULL || color_type == NULL)
return (0); return (0);
if (width != NULL)
*width = info_ptr->width; *width = info_ptr->width;
if (height != NULL)
*height = info_ptr->height; *height = info_ptr->height;
if (bit_depth != NULL)
*bit_depth = info_ptr->bit_depth; *bit_depth = info_ptr->bit_depth;
if (color_type != NULL)
*color_type = info_ptr->color_type; *color_type = info_ptr->color_type;
if (compression_type != NULL) if (compression_type != NULL)