# HG changeset patch # User bcoudurier # Date 1211403882 0 # Node ID e4ff879325c0fe9826befb273a81cc769b5fb31b # Parent 4d73d137f64ed114b6a4915ad00f3b97135777fe check pkt stream index before returning packet, prevent segfault diff -r 4d73d137f64e -r e4ff879325c0 ffm.c --- 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;