[FFmpeg-devel] [PATCH 03/12] avutil/mathematics: Fix undefined negation in av_compare_ts()
Michael Niedermayer
michael at niedermayer.cc
Sun Jan 31 21:18:09 EET 2021
Fixes: negation of -9223372036854775808 cannot be represented in type 'int64_t' (aka 'long'); cast to an unsigned type to negate this value to itself
Fixes: 29437/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4748510022991872
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavutil/mathematics.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index da0fc17b2e..2de2b39da0 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -148,7 +148,7 @@ int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b)
{
int64_t a = tb_a.num * (int64_t)tb_b.den;
int64_t b = tb_b.num * (int64_t)tb_a.den;
- if ((FFABS(ts_a)|a|FFABS(ts_b)|b) <= INT_MAX)
+ if ((FFABS64U(ts_a)|a|FFABS64U(ts_b)|b) <= INT_MAX)
return (ts_a*a > ts_b*b) - (ts_a*a < ts_b*b);
if (av_rescale_rnd(ts_a, a, b, AV_ROUND_DOWN) < ts_b)
return -1;
--
2.17.1
More information about the ffmpeg-devel
mailing list