[libpng] Check compression_type parameter in png_get_iCCP and remove spurious

casts. The compression_type parameter is always assigned to, so must
be non-NULL. The cast of the profile length potentially truncated the
value unnecessarily on a 16-bit int system, so the cast of the (byte)
compression type to (int) is specified by ANSI-C anyway.
This commit is contained in:
John Bowler 2011-11-04 20:11:16 -05:00 committed by Glenn Randers-Pehrson
parent aad7c828b2
commit 88bcdc269b
3 changed files with 17 additions and 6 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.5.7beta02 - November 4, 2011 Libpng 1.5.7beta02 - November 5, 2011
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.
@ -43,7 +43,12 @@ Version 1.5.7beta01 [November 4, 2011]
just the changes that definitely improve speed and remain simple. just the changes that definitely improve speed and remain simple.
The changes also slightly increase the clarity of the code. The changes also slightly increase the clarity of the code.
Version 1.5.7beta02 [November 4, 2011] Version 1.5.7beta02 [November 5, 2011]
Check compression_type parameter in png_get_iCCP and remove spurious
casts. The compression_type parameter is always assigned to, so must
be non-NULL. The cast of the profile length potentially truncated the
value unnecessarily on a 16-bit int system, so the cast of the (byte)
compression type to (int) is specified by ANSI-C anyway.
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

@ -3686,7 +3686,12 @@ Version 1.5.7beta01 [November 4, 2011]
just the changes that definitely improve speed and remain simple. just the changes that definitely improve speed and remain simple.
The changes also slightly increase the clarity of the code. The changes also slightly increase the clarity of the code.
Version 1.5.7beta02 [November 4, 2011] Version 1.5.7beta02 [November 5, 2011]
Check compression_type parameter in png_get_iCCP and remove spurious
casts. The compression_type parameter is always assigned to, so must
be non-NULL. The cast of the profile length potentially truncated the
value unnecessarily on a 16-bit int system, so the cast of the (byte)
compression type to (int) is specified by ANSI-C anyway.
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

@ -682,15 +682,16 @@ png_get_iCCP(png_const_structp png_ptr, png_const_infop info_ptr,
png_debug1(1, "in %s retrieval function", "iCCP"); png_debug1(1, "in %s retrieval function", "iCCP");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
&& name != NULL && profile != NULL && proflen != NULL) && name != NULL && compression_type != NULL && profile != NULL &&
proflen != NULL)
{ {
*name = info_ptr->iccp_name; *name = info_ptr->iccp_name;
*profile = info_ptr->iccp_profile; *profile = info_ptr->iccp_profile;
/* Compression_type is a dummy so the API won't have to change /* Compression_type is a dummy so the API won't have to change
* if we introduce multiple compression types later. * if we introduce multiple compression types later.
*/ */
*proflen = (int)info_ptr->iccp_proflen; *proflen = info_ptr->iccp_proflen;
*compression_type = (int)info_ptr->iccp_compression; *compression_type = info_ptr->iccp_compression;
return (PNG_INFO_iCCP); return (PNG_INFO_iCCP);
} }