[FFmpeg-cvslog] lavu/common.h: Fix UB in av_clip_intp2_c()

Tomas Härdin git at videolan.org
Fri Jun 14 15:30:17 EEST 2024


ffmpeg | branch: master | Tomas Härdin <git at haerdin.se> | Thu May 16 16:33:44 2024 +0200| [60ab40be7086ad80418192a3eaf2f2b860c10369] | committer: Tomas Härdin

lavu/common.h: Fix UB in av_clip_intp2_c()

Found by value analysis

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

 libavutil/common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/common.h b/libavutil/common.h
index 92b5d27ef1..29cef74826 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -265,7 +265,7 @@ static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
  */
 static av_always_inline av_const int av_clip_intp2_c(int a, int p)
 {
-    if (((unsigned)a + (1 << p)) & ~((2 << p) - 1))
+    if (((unsigned)a + (1U << p)) & ~((2U << p) - 1))
         return (a >> 31) ^ ((1 << p) - 1);
     else
         return a;



More information about the ffmpeg-cvslog mailing list