ffserver: prevent nb_streams from becoming too large
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 12 Oct 2012 22:30:42 +0000 (00:30 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 12 Oct 2012 22:31:21 +0000 (00:31 +0200)
Fixes CID732249

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

index cb7e3ae..955c326 100644 (file)
@@ -3474,6 +3474,9 @@ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int cop
 {
     AVStream *fst;
 
+    if(stream->nb_streams >= FF_ARRAY_ELEMS(stream->streams))
+        return NULL;
+
     fst = av_mallocz(sizeof(AVStream));
     if (!fst)
         return NULL;
@@ -3821,6 +3824,9 @@ static void add_codec(FFStream *stream, AVCodecContext *av)
 {
     AVStream *st;
 
+    if(stream->nb_streams >= FF_ARRAY_ELEMS(stream->streams))
+        return NULL;
+
     /* compute default parameters */
     switch(av->codec_type) {
     case AVMEDIA_TYPE_AUDIO: