mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
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:
parent
846e93c5d1
commit
28ad70c56d
@ -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)) {
|
if (png_get_valid(png, info, PNG_INFO_tRNS)) {
|
||||||
png_set_tRNS_to_alpha(png);
|
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) {
|
if (!keep_alpha) {
|
||||||
png_set_strip_alpha(png);
|
png_set_strip_alpha(png);
|
||||||
|
Loading…
Reference in New Issue
Block a user