aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-08-26 13:37:27 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-08 21:31:50 +0200
commit3d5f361290abcc16f6b003bab6ad84ad05aad2b0 (patch)
treed1748bfc97bed3b79f1b3df0aa5d6b6b6684c00c
parente64b4a75bdb4dd32a6478ffeca649882e3804956 (diff)
downloadffmpeg-3d5f361290abcc16f6b003bab6ad84ad05aad2b0.tar.gz
avformat/mov: Check dts for overflow in mov_read_trun()
Fixes: signed integer overflow: 9223372034248226491 + 3275247799 cannot be represented in type 'long' Fixes: clusterfuzz-testcase-minimized-audio_decoder_fuzzer-4538729166077952 Reported-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 4de4bc06fdfd0383f3d9012c6557a38408a09d28) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mov.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index b49dd01543..a7a31dada1 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4992,6 +4992,8 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
"size %u, distance %d, keyframe %d\n", st->index,
index_entry_pos, offset, dts, sample_size, distance, keyframe);
distance++;
+ if (av_sat_add64(dts, sample_duration) != dts + (uint64_t)sample_duration)
+ return AVERROR_INVALIDDATA;
dts += sample_duration;
offset += sample_size;
sc->data_size += sample_size;