summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c5
1 files changed, 5 insertions, 0 deletions
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; i<ac->nb_programs; i++){
if(ac->programs[i]->id != progid)
continue;