[FFmpeg-cvslog] lavu/common.h: Fix UB in av_clipl_int32_c()
Tomas Härdin
git at videolan.org
Fri Jun 14 15:30:15 EEST 2024
ffmpeg | branch: master | Tomas Härdin <git at haerdin.se> | Wed May 15 21:03:47 2024 +0200| [818a487849b9f8234275f800f78f318750dc7e6d] | committer: Tomas Härdin
lavu/common.h: Fix UB in av_clipl_int32_c()
Found by value analysis
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=818a487849b9f8234275f800f78f318750dc7e6d
---
libavutil/common.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavutil/common.h b/libavutil/common.h
index 1f5db42cb2..92b5d27ef1 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -253,8 +253,8 @@ static av_always_inline av_const int16_t av_clip_int16_c(int a)
*/
static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
{
- if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
- else return (int32_t)a;
+ if ((a+UINT64_C(0x80000000)) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
+ else return (int32_t)a;
}
/**
More information about the ffmpeg-cvslog
mailing list