Commit 465b6fc8 authored by bcoudurier's avatar bcoudurier

check pkt stream index before returning packet, prevent segfault

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@13224 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent db65a005
...@@ -610,6 +610,12 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -610,6 +610,12 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
av_new_packet(pkt, size); av_new_packet(pkt, size);
pkt->stream_index = ffm->header[0]; pkt->stream_index = ffm->header[0];
if ((unsigned)pkt->stream_index >= s->nb_streams) {
av_log(s, AV_LOG_ERROR, "invalid stream index %d\n", pkt->stream_index);
av_free_packet(pkt);
ffm->read_state = READ_HEADER;
return AVERROR(EAGAIN);
}
pkt->pos = url_ftell(s->pb); pkt->pos = url_ftell(s->pb);
if (ffm->header[1] & FLAG_KEY_FRAME) if (ffm->header[1] & FLAG_KEY_FRAME)
pkt->flags |= PKT_FLAG_KEY; pkt->flags |= PKT_FLAG_KEY;
......
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