[FFmpeg-cvslog] avformat/mov: Break out early if chunk_count is 0 in mov_build_index()

Michael Niedermayer git at videolan.org
Tue Jul 10 12:05:40 EEST 2018


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Tue May 15 17:06:59 2018 +0200| [674929cd46c76285f4d739c0436a75a5402dee61] | committer: Michael Niedermayer

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 at niedermayer.cc>
(cherry picked from commit 56e76bd0579cc7f7b28860885d9e569a39daf41b)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=674929cd46c76285f4d739c0436a75a5402dee61
---

 libavformat/mov.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5a2ab732d3..c85d3a6eda 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2783,6 +2783,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;



More information about the ffmpeg-cvslog mailing list