Merge branch 'fix-png-get-trns' into 'master'

Fix potential crash in PNG_Read

See merge request KartKrew/Kart!917
This commit is contained in:
James R 2023-02-12 14:22:24 +00:00
commit 437944927e

View file

@ -999,9 +999,7 @@ static png_bytep *PNG_Read(
// color is present on the image, the palette flag is disabled. // color is present on the image, the palette flag is disabled.
if (usepal) if (usepal)
{ {
png_get_tRNS(png_ptr, png_info_ptr, &trans, &trans_num, &trans_values); if (png_get_tRNS(png_ptr, png_info_ptr, &trans, &trans_num, &trans_values) == PNG_INFO_tRNS)
if (trans && trans_num > 0)
{ {
INT32 i; INT32 i;
for (i = 0; i < trans_num; i++) for (i = 0; i < trans_num; i++)