ffmpeg: fix segfault with too many output files
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 3 Jun 2011 23:24:00 +0000 (01:24 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 3 Jun 2011 23:24:00 +0000 (01:24 +0200)
Fixes Ticket219

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ffmpeg.c

index e5986a6..35436aa 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3863,6 +3863,11 @@ static void opt_output_file(const char *filename)
     AVFormatParameters params, *ap = &params;
     AVOutputFormat *file_oformat;
 
     AVFormatParameters params, *ap = &params;
     AVOutputFormat *file_oformat;
 
+    if(nb_output_files >= FF_ARRAY_ELEMS(output_files)){
+        fprintf(stderr, "Too many output files\n");
+        ffmpeg_exit(1);
+    }
+
     if (!strcmp(filename, "-"))
         filename = "pipe:";
 
     if (!strcmp(filename, "-"))
         filename = "pipe:";