Commit 8664dae4 authored by aurel's avatar aurel

add out of bound stream index checks

fix issue379


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@12417 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 04db8d72
......@@ -2356,7 +2356,7 @@ matroska_read_header (AVFormatContext *s,
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(MatroskaDemuxContext *matroska, uint8_t *data, int size,
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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment