[FFmpeg-cvslog] mpc8: check stream count before accessing stream 1.

Michael Niedermayer git at videolan.org
Thu Jan 24 04:46:50 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Jan 24 02:51:12 2013 +0100| [69fb605ad5e0f1384ca4d06d38ce0f1b6c8c286d] | committer: Michael Niedermayer

mpc8: check stream count before accessing stream 1.

Fixes null pointer dereference

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/mpc8.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index 011c7c8..73f8057 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, "cannot parse stream table before stream header\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 ffmpeg-cvslog mailing list