[libav-stable] mpc8: Make sure the first stream exists before parsing the seek table

Martin Storsjö git at libav.org
Thu Sep 12 09:58:53 CEST 2013


Module: libav
Branch: master
Commit: 17d57848fc14e82f76a65ffb25c90f2f011dc4a0

Author:    Martin Storsjö <martin at martin.st>
Committer: Martin Storsjö <martin at martin.st>
Date:      Wed Sep 11 22:53:15 2013 +0300

mpc8: Make sure the first stream exists before parsing the seek table

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>

---

 libavformat/mpc8.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index 29001b1..3564e81 100644
--- a/libavformat/mpc8.c
+++ b/libavformat/mpc8.c
@@ -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){



More information about the libav-stable mailing list