[FFmpeg-cvslog] avfilter/vf_palettegen: fix integer overflow

Paul B Mahol git at videolan.org
Thu Aug 19 02:53:44 EEST 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Aug 18 23:25:11 2021 +0200| [124eec942a02d1c723c71de4baf62965315c84b7] | committer: Paul B Mahol

avfilter/vf_palettegen: fix integer overflow

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=124eec942a02d1c723c71de4baf62965315c84b7
---

 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)



More information about the ffmpeg-cvslog mailing list