check return value of matroska_find_track_by_num (fix a segfault)
authorAurelien Jacobs <aurel@gnuage.org>
Mon, 31 Mar 2008 20:16:04 +0000 (20:16 +0000)
committerAurelien Jacobs <aurel@gnuage.org>
Mon, 31 Mar 2008 20:16:04 +0000 (20:16 +0000)
Originally committed as revision 12659 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/matroskadec.c

index a4274f3..86a3994 100644 (file)
@@ -2355,6 +2355,7 @@ matroska_read_header (AVFormatContext    *s,
         for (i=0; i<matroska->num_indexes; i++) {
             MatroskaDemuxIndex *idx = &matroska->index[i];
             track = matroska_find_track_by_num(matroska, idx->track);
+            if (track < 0)  continue;
             stream = matroska->tracks[track]->stream_index;
             if (stream >= 0 && stream < matroska->ctx->nb_streams)
                 av_add_index_entry(matroska->ctx->streams[stream],