[libpng16] 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-09 20:28:26 -06:00
parent a8488b78dc
commit b0673cb50f
3 changed files with 8 additions and 0 deletions

View File

@ -35,6 +35,7 @@ Version 1.5.14beta01 [October 24, 2012]
Version 1.5.14beta02 [December 10, 2012]
Added missing "-" in front of DNO_GZIP in contrib/pngminim/*/makefile.
Check for png_ptr==NULL earlier in png_zalloc().
Ignore, with a warning, out-of-range value of num_trans in png_set_tRNS().
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -3928,6 +3928,7 @@ Version 1.5.14beta01 [October 24, 2012]
Version 1.5.14beta02 [December 10, 2012]
Added missing "-" in front of DNO_GZIP in contrib/pngminim/*/makefile.
Check for png_ptr==NULL earlier in png_zalloc().
Ignore, with a warning, out-of-range value of num_trans in png_set_tRNS().
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -897,6 +897,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;