imageio: fix issues/crash on png with transparency

If a png has a transparency chunk (tRNS), after converting the
transparency to alpha we should also strip alpha (color_type is not
updated with PNG_COLOR_MASK_ALPHA flag set) or the row parsing will
return also the alpha channel causing a memory overflow.
This commit is contained in:
Simone Gotti
2024-03-29 15:16:55 +01:00
parent 11240bc97d
commit 52e88e8954

View File

@@ -285,6 +285,7 @@ int ImageIO::loadPNG (const Glib::ustring &fname)
if (png_get_valid(png, info, PNG_INFO_tRNS)) {
png_set_tRNS_to_alpha(png);
png_set_strip_alpha(png);
}
if (color_type & PNG_COLOR_MASK_ALPHA) {