aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2008-03-10 21:23:06 +0000
committerAurelien Jacobs <aurel@gnuage.org>2008-03-10 21:23:06 +0000
commit074ac3c2d04abaf6b8b1048ba55a1e4ade13042f (patch)
tree2e6872a34bda23ed3a7275c3e991722f1de0bcd3 /libavformat
parent1b9cec96e15e002cfad45b9841b2b88d994980df (diff)
downloadffmpeg-074ac3c2d04abaf6b8b1048ba55a1e4ade13042f.tar.gz
add out of bound stream index checks
fix issue379 Originally committed as revision 12417 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/matroskadec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 8040388e84..a4274f310f 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -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;
}