[FFmpeg-cvslog] matroskadec: check s->streams[k] before using it

Andreas Cadhalpun git at videolan.org
Tue Jun 2 00:50:18 CEST 2015


ffmpeg | branch: release/2.4 | Andreas Cadhalpun <andreas.cadhalpun at googlemail.com> | Sun May  3 23:55:20 2015 +0200| [84cc40cbe154ecc7ad460b879d39ad9df62957a6] | committer: Michael Niedermayer

matroskadec: check s->streams[k] before using it

This fixes a segmentation fault.

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

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/matroskadec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index c06bc2e..7618284 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1942,7 +1942,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;



More information about the ffmpeg-cvslog mailing list