matroskadec: check s->streams[k] before using it
authorAndreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Sun, 3 May 2015 21:55:20 +0000 (23:55 +0200)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Thu, 14 May 2015 17:09:32 +0000 (19:09 +0200)
This fixes a segmentation fault.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e54540655f229d06667dc7fa7005f2a20e101e80)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavformat/matroskadec.c

index 0756d04..d1e758a 100644 (file)
@@ -2004,7 +2004,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
                 snprintf(buf, sizeof(buf), "%s_%d",
                          ff_matroska_video_stereo_plane[planes[j].type], i);
                 for (k=0; k < matroska->tracks.nb_elem; k++)
-                    if (planes[j].uid == tracks[k].uid) {
+                    if (planes[j].uid == tracks[k].uid && s->streams[k]) {
                         av_dict_set(&s->streams[k]->metadata,
                                     "stereo_mode", buf, 0);
                         break;