# HG changeset patch # User aurel # Date 1205184186 0 # Node ID ce03321a2cc852a265490e8273b80aac600aba91 # Parent 20db4653d6961d7745b3a5a2f2333f52f5f3e352 add out of bound stream index checks fix issue379 diff -r 20db4653d696 -r ce03321a2cc8 matroskadec.c --- a/matroskadec.c Mon Mar 10 21:09:27 2008 +0000 +++ b/matroskadec.c Mon Mar 10 21:23:06 2008 +0000 @@ -2356,7 +2356,7 @@ 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 @@ 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; }