aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-05-15 17:06:59 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-06-18 01:16:04 +0200
commitce7be9cdc5d53242e1b326f40289c2ceec63a2d1 (patch)
tree3a3927d5a3ae91ec6ee7572b81b89ec5d637e082
parent26667dc5baaf922ce24933bb1509515b1eb05e9b (diff)
downloadffmpeg-ce7be9cdc5d53242e1b326f40289c2ceec63a2d1.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 5ebca26ae5..9f30e21355 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3572,6 +3572,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;