aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-05-15 17:06:59 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-07-16 19:06:27 +0200
commitaa50d67cc7d07278ce39d395871bc6a0dc7cfe32 (patch)
treed4825cf0a16a85ddc94f8a4a216c5714ce53632f
parent05e253684ebc2985b0c4662a9f86e4475c20a5e4 (diff)
downloadffmpeg-aa50d67cc7d07278ce39d395871bc6a0dc7cfe32.tar.gz
avformat/mov: Break out early if chunk_count is 0 in mov_build_index()
Without this some operations might overflow (undefined behavior) even though the index adding loop would never execute No testcase known Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 56e76bd0579cc7f7b28860885d9e569a39daf41b) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mov.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 11526346be..c4d3863de9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3516,6 +3516,9 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
} else {
unsigned chunk_samples, total = 0;
+ if (!sc->chunk_count)
+ return;
+
// compute total chunk count
for (i = 0; i < sc->stsc_count; i++) {
unsigned count, chunk_count;