]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mov: Check STCO location
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 11 Jan 2020 11:09:08 +0000 (12:09 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 30 Jan 2020 18:58:45 +0000 (19:58 +0100)
Fixes: bypassing of checks and assertion failure
Fixes: asan_1003879.mp4
Found-by: Clusterfuzz + asan
Reported-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mov.c

index 3a183ed0153e76c09fc43b1f472fe7ae9cce1ea7..bbaf266a4b5d091dd209d7083bfc5d7431e6e88e 100644 (file)
@@ -1978,6 +1978,10 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     MOVStreamContext *sc;
     unsigned int i, entries;
 
+    if (c->trak_index < 0) {
+        av_log(c->fc, AV_LOG_WARNING, "STCO outside TRAK\n");
+        return 0;
+    }
     if (c->fc->nb_streams < 1)
         return 0;
     st = c->fc->streams[c->fc->nb_streams-1];