You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
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@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
@@ -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)
|
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);
|
return (a >> 31) ^ ((1 << p) - 1);
|
||||||
else
|
else
|
||||||
return a;
|
return a;
|
||||||
|
Reference in New Issue
Block a user