aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-05-15 17:06:59 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-05-21 01:38:56 +0200
commit56e76bd0579cc7f7b28860885d9e569a39daf41b (patch)
tree6adfb4af0dd09aed588683805e4e926d65416b22
parentfac5849915973ac09286d2c027237bfd99cc27fe (diff)
downloadffmpeg-56e76bd0579cc7f7b28860885d9e569a39daf41b.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>
-rw-r--r--libavformat/mov.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1975011741..4848a106f2 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3900,6 +3900,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;