lavf/asfenc: check the number of streams in header
authorMarton Balint <cus@passwd.hu>
Wed, 3 Feb 2016 21:53:56 +0000 (22:53 +0100)
committerMarton Balint <cus@passwd.hu>
Fri, 5 Feb 2016 20:32:14 +0000 (21:32 +0100)
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
libavformat/asfenc.c

index 9f082c6..6932c11 100644 (file)
@@ -684,6 +684,11 @@ static int asf_write_header(AVFormatContext *s)
     s->max_interleave_delta = 0;
     asf->nb_packets = 0;
 
+    if (s->nb_streams > 127) {
+        av_log(s, AV_LOG_ERROR, "ASF can only handle 127 streams\n");
+        return AVERROR(EINVAL);
+    }
+
     asf->index_ptr             = av_malloc(sizeof(ASFIndex) * ASF_INDEX_BLOCK);
     if (!asf->index_ptr)
         return AVERROR(ENOMEM);