[libpng16] Ensure png_ptr->trans_values is set in png_set_tRNS().

This commit is contained in:
Glenn Randers-Pehrson 2016-05-27 20:09:23 -05:00
parent 8d16725373
commit 6c7459e455

View File

@ -955,10 +955,11 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH) if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
{ {
/* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */ /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
png_ptr->trans_alpha = info_ptr->trans_alpha = png_voidcast(png_bytep, info_ptr->trans_alpha = png_voidcast(png_bytep,
png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH)); png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans); memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans);
} }
png_ptr->trans_alpha = info_ptr->trans_alpha;
} }
if (trans_color != NULL) if (trans_color != NULL)