Fix PNG decoding bug

some png with palette-based alpha channels were incorrectly
treated as alpha-less, causing segfault.

Change-Id: I03883590f9539848d5135d359b6f105d2b14329f
This commit is contained in:
Pascal Massimino 2011-09-20 07:51:02 -07:00
parent 846e93c5d1
commit 28ad70c56d

View File

@ -382,8 +382,10 @@ static int ReadPNG(FILE* in_file, WebPPicture* const pic, int keep_alpha) {
}
if (png_get_valid(png, info, PNG_INFO_tRNS)) {
png_set_tRNS_to_alpha(png);
has_alpha = 1;
} else {
has_alpha = !!(color_type & PNG_COLOR_MASK_ALPHA);
}
has_alpha = !!(color_type & PNG_COLOR_MASK_ALPHA);
if (!keep_alpha) {
png_set_strip_alpha(png);