From 124eec942a02d1c723c71de4baf62965315c84b7 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Wed, 18 Aug 2021 23:25:11 +0200 Subject: [PATCH] avfilter/vf_palettegen: fix integer overflow --- libavfilter/vf_palettegen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c index ef8bc181c5..048ef8e994 100644 --- a/libavfilter/vf_palettegen.c +++ b/libavfilter/vf_palettegen.c @@ -113,8 +113,8 @@ static int cmp_##name(const void *pa, const void *pb) \ { \ const struct color_ref * const *a = pa; \ const struct color_ref * const *b = pb; \ - return ((*a)->color >> (8 * (2 - (pos))) & 0xff) \ - - ((*b)->color >> (8 * (2 - (pos))) & 0xff); \ + return (int)((*a)->color >> (8 * (2 - (pos))) & 0xff) \ + - (int)((*b)->color >> (8 * (2 - (pos))) & 0xff); \ } DECLARE_CMP_FUNC(r, 0)