aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-05-15 17:06:59 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-10-23 01:44:40 +0200
commitb4024909c12118e0a128ada65b53c012296a2626 (patch)
treeef5edc95f5027839aba23277c4b8923c6da72849
parentfe9c23bebbb2aa8e14eec9af1e99cabc8c5535ba (diff)
downloadffmpeg-b4024909c12118e0a128ada65b53c012296a2626.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 4faa90fd99..c359e93e96 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2829,6 +2829,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;