diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2008-05-22 01:04:42 +0400 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2008-05-22 01:04:42 +0400 |
commit | 2ea2340e34e8dbd18903a7fca8cc9cc037fd9487 (patch) | |
tree | 8c13188f4efec0b4179492d536ccbddd94f9e602 /libavformat/ffm.c | |
parent | c4355f4eaa804bd9b10a2b30cd2dbf445ccc3817 (diff) |
check pkt stream index before returning packet, prevent segfault
Originally committed as revision 13224 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/ffm.c')
-rw-r--r-- | libavformat/ffm.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/ffm.c b/libavformat/ffm.c index 872e6f0ba8..bb2ee4bc97 100644 --- a/libavformat/ffm.c +++ b/libavformat/ffm.c @@ -610,6 +610,12 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt) av_new_packet(pkt, size); 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); if (ffm->header[1] & FLAG_KEY_FRAME) pkt->flags |= PKT_FLAG_KEY; |