From 797c2ecc8fca65721b79637073df0a31fe31c463 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Wed, 22 Jan 2020 01:47:21 +0100 Subject: avfilter/vf_paletteuse: Fix left shift outside of range of int by keeping the variable uint32_t which in this situation is the natural type anyway. This affected the FATE-test filter-paletteuse-sierra2_4a. Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_paletteuse.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libavfilter/vf_paletteuse.c') diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c index fc07c2581d..f4c7d60435 100644 --- a/libavfilter/vf_paletteuse.c +++ b/libavfilter/vf_paletteuse.c @@ -152,9 +152,10 @@ static int query_formats(AVFilterContext *ctx) return 0; } -static av_always_inline int dither_color(uint32_t px, int er, int eg, int eb, int scale, int shift) +static av_always_inline uint32_t dither_color(uint32_t px, int er, int eg, + int eb, int scale, int shift) { - return av_clip_uint8( px >> 24 ) << 24 + return px >> 24 << 24 | av_clip_uint8((px >> 16 & 0xff) + ((er * scale) / (1<> 8 & 0xff) + ((eg * scale) / (1<