[libpng14] Ignore, with a warning, out-of-range value of num_trans

in png_set_tRNS().
This commit is contained in:
Glenn Randers-Pehrson 2012-12-10 10:07:29 -06:00
parent 49ee184ba0
commit b4c2bc864f
3 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.4.13beta01 - August 3, 2012
Libpng 1.4.13beta01 - December 10, 2012
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.
@ -32,9 +32,10 @@ version 1.4.12 [July 10, 2012]
pngsuite/README.txt.
Changed "a+w" to "u+w" in Makefile.in to fix CVE-2012-3386.
version 1.4.13beta01 [August 3, 2012]
version 1.4.13beta01 [December 10, 2012]
Do not compile PNG_DEPRECATED, PNG_ALLOC and PNG_PRIVATE when __GNUC__ < 3.
Removed references to png_zalloc() and png_zfree() from the manual.
Ignore, with a warning, out-of-range value of num_trans in png_set_tRNS().
Send comments/corrections/commendations to glennrp at users.sourceforge.net
or to png-mng-implement at lists.sf.net (subscription required; visit

View File

@ -2874,9 +2874,10 @@ version 1.4.12 [July 10, 2012]
pngsuite/README.txt.
Changed "a+w" to "u+w" in Makefile.in to fix CVE-2012-3386.
version 1.4.13beta01 [August 3, 2012]
version 1.4.13beta01 [December 10, 2012]
Do not compile PNG_DEPRECATED, PNG_ALLOC and PNG_PRIVATE when __GNUC__ < 3.
Removed references to png_zalloc() and png_zfree() from the manual.
Ignore, with a warning, out-of-range value of num_trans in png_set_tRNS().
Send comments/corrections/commendations to glennrp at users.sourceforge.net
or to png-mng-implement at lists.sf.net (subscription required; visit

View File

@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
* Last changed in libpng 1.4.11 [March 29, 2012]
* Last changed in libpng 1.4.13 [December 10, 2012]
* Copyright (c) 1998-2012 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.)
@ -836,6 +836,12 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
if (png_ptr == NULL || info_ptr == NULL)
return;
if (num_trans < 0 || num_trans > PNG_MAX_PALETTE_LENGTH)
{
png_warning(png_ptr, "Ignoring invalid num_trans value");
return;
}
if (trans_alpha != NULL)
{
/* It may not actually be necessary to set png_ptr->trans_alpha here;