[FFmpeg-cvslog] r12417 - trunk/libavformat/matroskadec.c

aurel subversion
Mon Mar 10 22:23:07 CET 2008


Author: aurel
Date: Mon Mar 10 22:23:06 2008
New Revision: 12417

Log:
add out of bound stream index checks
fix issue379


Modified:
   trunk/libavformat/matroskadec.c

Modified: trunk/libavformat/matroskadec.c
==============================================================================
--- trunk/libavformat/matroskadec.c	(original)
+++ trunk/libavformat/matroskadec.c	Mon Mar 10 22:23:06 2008
@@ -2356,7 +2356,7 @@ matroska_read_header (AVFormatContext   
             MatroskaDemuxIndex *idx = &matroska->index[i];
             track = matroska_find_track_by_num(matroska, idx->track);
             stream = matroska->tracks[track]->stream_index;
-            if (stream >= 0)
+            if (stream >= 0 && stream < matroska->ctx->nb_streams)
                 av_add_index_entry(matroska->ctx->streams[stream],
                                    idx->pos, idx->time/matroska->time_scale,
                                    0, 0, AVINDEX_KEYFRAME);
@@ -2400,7 +2400,7 @@ matroska_parse_block(MatroskaDemuxContex
         return res;
     }
     stream_index = matroska->tracks[track]->stream_index;
-    if (stream_index < 0) {
+    if (stream_index < 0 || stream_index >= matroska->ctx->nb_streams) {
         av_free(origdata);
         return res;
     }




More information about the ffmpeg-cvslog mailing list