diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c index e58e19f5bf..4f44fd4d53 100644 --- a/libavcodec/gifdec.c +++ b/libavcodec/gifdec.c @@ -241,9 +241,8 @@ static int gif_read_image(GifState *s) pr = ptr + width; for (px = ptr, idx = s->idx_line; px < pr; px++, idx++) { - *px = pal[*idx]; - if (*idx == s->transparent_color_index) - *px &= 0xFFFFFF; + if (*idx != s->transparent_color_index) + *px = pal[*idx]; } if (is_interleaved) {