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

This commit is contained in:
Glenn Randers-Pehrson 2015-01-02 08:23:24 -06:00
parent ae31a1ebdb
commit 9c078fb7d2
5 changed files with 43 additions and 33 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.7.0beta46 - January 1, 2015
Libpng 1.7.0beta46 - January 2, 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.
@ -681,10 +681,11 @@ Version 1.7.0beta45 [December 28, 2014]
png_read_row to skip the unnecessary row de-interlace stuff.
Added testing of png_set_packing() to pngvalid.c
Version 1.7.0beta46 [January 1, 2015]
Version 1.7.0beta46 [January 2, 2015]
Regenerated configure scripts in the tar distributions with libtool-2.4.4
Implement previously untested cases of libpng transforms in pngvalid.c
Fixed byte order in 2-byte filler, in png_do_read_filler().
Allow user to call png_get_IHDR() with NULL arguments (Reuben Hawkins).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -4970,10 +4970,11 @@ Version 1.7.0beta45 [December 28, 2014]
png_read_row to skip the unnecessary row de-interlace stuff.
Added testing of png_set_packing() to pngvalid.c
Version 1.7.0beta46 [January 1, 2015]
Version 1.7.0beta46 [January 2, 2015]
Regenerated configure scripts in the tar distributions with libtool-2.4.4
Implement previously untested cases of libpng transforms in pngvalid.c
Fixed byte order in 2-byte filler, in png_do_read_filler().
Allow user to call png_get_IHDR() with NULL arguments (Reuben Hawkins).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.7.0beta46 - January 1, 2015
libpng version 1.7.0beta46 - January 2, 2015
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
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.7.0beta46 - January 1, 2015
libpng versions 0.97, January 1998, through 1.7.0beta46 - January 2, 2015
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2015 Glenn Randers-Pehrson
@ -1266,16 +1266,17 @@ in until png_read_end() has read the chunk data following the image.
the PNG datastream is embedded in
a MNG-1.0 datastream)
Any or all of interlace_type, compression_type, or
filter_method can be NULL if you are
not interested in their values.
Any or all of color_tye, bit_depth, interlace_type,
compression_type, or filter_method can 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 png_uint_32 data into
the application's width and height variables.
This is an unsafe situation if these are 16-bit
variables. In such situations, the
png_get_image_width() and png_get_image_height()
functions described below are safer.
variables, or if they are 32-bit variables on a 64-bit
platform. In such situations, the png_get_image_width()
and png_get_image_height() functions described below are
safer.
width = png_get_image_width(png_ptr,
info_ptr);
@ -5320,7 +5321,7 @@ Other rules can be inferred by inspecting the libpng source.
XVII. Y2K Compliance in libpng
January 1, 2015
January 2, 2015
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.

View File

@ -1,4 +1,4 @@
.TH LIBPNG 3 "January 1, 2015"
.TH LIBPNG 3 "January 2, 2015"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta46
.SH SYNOPSIS
@ -494,7 +494,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.7.0beta46 - January 1, 2015
libpng version 1.7.0beta46 - January 2, 2015
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2015 Glenn Randers-Pehrson
@ -505,7 +505,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.7.0beta46 - January 1, 2015
libpng versions 0.97, January 1998, through 1.7.0beta46 - January 2, 2015
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2015 Glenn Randers-Pehrson
@ -1760,16 +1760,17 @@ in until png_read_end() has read the chunk data following the image.
the PNG datastream is embedded in
a MNG-1.0 datastream)
Any or all of interlace_type, compression_type, or
filter_method can be NULL if you are
not interested in their values.
Any or all of color_tye, bit_depth, interlace_type,
compression_type, or filter_method can 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 png_uint_32 data into
the application's width and height variables.
This is an unsafe situation if these are 16-bit
variables. In such situations, the
png_get_image_width() and png_get_image_height()
functions described below are safer.
variables, or if they are 32-bit variables on a 64-bit
platform. In such situations, the png_get_image_width()
and png_get_image_height() functions described below are
safer.
width = png_get_image_width(png_ptr,
info_ptr);
@ -5814,7 +5815,7 @@ Other rules can be inferred by inspecting the libpng source.
.SH XVII. Y2K Compliance in libpng
January 1, 2015
January 2, 2015
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
@ -6084,7 +6085,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.7.0beta46 - January 1, 2015:
Libpng version 1.7.0beta46 - January 2, 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).
@ -6107,7 +6108,7 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.7.0beta46, January 1, 2015, are
libpng versions 1.2.6, August 15, 2004, through 1.7.0beta46, January 2, 2015, are
Copyright (c) 2004,2006-2007 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
@ -6206,7 +6207,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
January 1, 2015
January 2, 2015
.\" end of man page

View File

@ -799,14 +799,20 @@ png_get_IHDR(png_const_structrp png_ptr, png_const_inforp info_ptr,
{
png_debug1(1, "in %s retrieval function", "IHDR");
if (png_ptr == NULL || info_ptr == NULL || width == NULL ||
height == NULL || bit_depth == NULL || color_type == NULL)
if (png_ptr == NULL || info_ptr == NULL)
return (0);
*width = info_ptr->width;
*height = info_ptr->height;
*bit_depth = info_ptr->bit_depth;
*color_type = info_ptr->color_type;
if (width != NULL)
*width = info_ptr->width;
if (height != NULL)
*height = info_ptr->height;
if (bit_depth != NULL)
*bit_depth = info_ptr->bit_depth;
if (color_type != NULL)
*color_type = info_ptr->color_type;
if (compression_type != NULL)
*compression_type = info_ptr->compression_type;