mirror of
https://github.com/librempeg/librempeg
synced 2024-11-23 03:28:27 +00:00
avutil/common: Fix undefined behavior in av_clip_uintp2_c()
Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself Fixes: 8521/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5639024952737792 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
2e205bfc14
commit
aa41d322be
@ -228,7 +228,7 @@ static av_always_inline av_const int av_clip_intp2_c(int a, int p)
|
|||||||
*/
|
*/
|
||||||
static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
|
static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
|
||||||
{
|
{
|
||||||
if (a & ~((1<<p) - 1)) return -a >> 31 & ((1<<p) - 1);
|
if (a & ~((1<<p) - 1)) return (~a) >> 31 & ((1<<p) - 1);
|
||||||
else return a;
|
else return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user