From 72017ea1dcae1cd4f9c3dd68a3c1a9d941c6b02a Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Mon, 19 Oct 2009 18:55:27 +0000 Subject: check stream index validity in av_program_add_stream_index Originally committed as revision 20319 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/utils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index 58b3584c1d..4202fc26a2 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2833,6 +2833,11 @@ void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int i AVProgram *program=NULL; void *tmp; + if (idx >= ac->nb_streams) { + av_log(ac, AV_LOG_ERROR, "stream index %d is not valid\n", idx); + return; + } + for(i=0; inb_programs; i++){ if(ac->programs[i]->id != progid) continue; -- cgit v1.2.1