mpc8: Make sure the first stream exists before parsing the seek table
authorMartin Storsjö <martin@martin.st>
Wed, 11 Sep 2013 19:53:15 +0000 (22:53 +0300)
committerMartin Storsjö <martin@martin.st>
Thu, 12 Sep 2013 07:54:27 +0000 (10:54 +0300)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/mpc8.c

index 29001b1..3564e81 100644 (file)
@@ -139,6 +139,11 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
     int i, t, seekd;
     GetBitContext gb;
 
+    if (s->nb_streams == 0) {
+        av_log(s, AV_LOG_ERROR, "No stream added before parsing seek table\n");
+        return;
+    }
+
     avio_seek(s->pb, off, SEEK_SET);
     mpc8_get_chunk_header(s->pb, &tag, &size);
     if(tag != TAG_SEEKTABLE){