[FFmpeg-cvslog] lavu: prevent overflow in av_clip_intp2_c
Andreas Cadhalpun
git at videolan.org
Fri Jan 15 00:34:04 CET 2016
ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Thu Jan 14 01:15:22 2016 +0100| [f8bc0137bdf8da8806ef75d30bb749fcc301bb35] | committer: Andreas Cadhalpun
lavu: prevent overflow in av_clip_intp2_c
This fixes ubsan runtime error: signed integer overflow: 8388608 +
2140274688 cannot be represented in type 'int'
Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f8bc0137bdf8da8806ef75d30bb749fcc301bb35
---
libavutil/common.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavutil/common.h b/libavutil/common.h
index f9766ad..7b7bcbe 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -211,7 +211,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 ((a + (1 << p)) & ~((2 << p) - 1))
+ if (((unsigned)a + (1 << p)) & ~((2 << p) - 1))
return (a >> 31) ^ ((1 << p) - 1);
else
return a;
More information about the ffmpeg-cvslog
mailing list