[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

@@ -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;