lavf: check stream_index from read_packet() for validity.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-10-12 01:04:12 +02:00
parent f36ce75e35
commit d69fda9127
1 changed files with 5 additions and 0 deletions

View File

@ -762,6 +762,11 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt)
if(!(s->flags & AVFMT_FLAG_KEEP_SIDE_DATA))
av_packet_merge_side_data(pkt);
if(pkt->stream_index >= (unsigned)s->nb_streams){
av_log(s, AV_LOG_ERROR, "Invalid stream index %d\n", pkt->stream_index);
continue;
}
st= s->streams[pkt->stream_index];
switch(st->codec->codec_type){