summaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-06-14 15:41:33 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-06-15 21:52:29 +0200
commitaa41d322be71106ce147445f2b42bb763f1eff86 (patch)
treeb8e4ff2232548f57a9fefbead81d20d390011b4e /libavutil
parent2e205bfc14d8cecf88f8713275fe8e07454d00b5 (diff)
downloadffmpeg-streaming-aa41d322be71106ce147445f2b42bb763f1eff86.zip
ffmpeg-streaming-aa41d322be71106ce147445f2b42bb763f1eff86.tar.gz
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>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/common.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavutil/common.h b/libavutil/common.h
index 0fffa67..8db0291 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -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)
{
- 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;
}
OpenPOWER on IntegriCloud