Mercurial > libavformat.hg
changeset 3307:e4ff879325c0 libavformat
check pkt stream index before returning packet, prevent segfault
author | bcoudurier |
---|---|
date | Wed, 21 May 2008 21:04:42 +0000 |
parents | 4d73d137f64e |
children | 77b56bc6134f |
files | ffm.c |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ffm.c Wed May 21 07:05:08 2008 +0000 +++ b/ffm.c Wed May 21 21:04:42 2008 +0000 @@ -610,6 +610,12 @@ 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;