diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-04-20 17:40:56 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-07-22 23:33:26 +0200 |
commit | 7666d588ba1af26ce479e7fb92f7dc5b3a2ca48e (patch) | |
tree | 8a6fb8d4afc9a0a644d02f91e2a7cf8bb97903e0 | |
parent | 25c8507818d8559a6654a5b30a0f8aae11a48181 (diff) | |
download | ffmpeg-7666d588ba1af26ce479e7fb92f7dc5b3a2ca48e.tar.gz |
avformat/mov: Avoid undefined overflow in time_offset calculation
Fixes: signed integer overflow: 8511838621821575200 - -3954125146725285889 cannot be represented in type 'long'
Fixes: 33414/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6610119325515776
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-- | libavformat/mov.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 040babed95..3fc5a1e8ab 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3817,7 +3817,11 @@ static void mov_build_index(MOVContext *mov, AVStream *st) if ((empty_duration || start_time) && mov->time_scale > 0) { if (empty_duration) empty_duration = av_rescale(empty_duration, sc->time_scale, mov->time_scale); - sc->time_offset = start_time - empty_duration; + + if (av_sat_sub64(start_time, empty_duration) != start_time - (uint64_t)empty_duration) + av_log(mov->fc, AV_LOG_WARNING, "start_time - empty_duration is not representable\n"); + + sc->time_offset = start_time - (uint64_t)empty_duration; sc->min_corrected_pts = start_time; if (!mov->advanced_editlist) current_dts = -sc->time_offset; |