diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-01-31 15:51:40 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-02-10 12:28:29 +0100 |
commit | 7a239526146934a50c1cebd25e079a1027db545c (patch) | |
tree | 391d98dd77bfdbbe7902afb9844a55722b965a31 | |
parent | 1bda9bb68a1e273816c2c640e74e6de4f5632c33 (diff) | |
download | ffmpeg-7a239526146934a50c1cebd25e079a1027db545c.tar.gz |
avutil/mathematics: Fix undefined negation in av_compare_ts()
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@niedermayer.cc>
-rw-r--r-- | libavutil/mathematics.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; |