[FFmpeg-devel] [PATCH] fix DV muxer stream count check

Reimar Döffinger Reimar.Doeffinger
Sat May 12 16:53:09 CEST 2007

currently it is possible to pass the DV demuxer three audio streams
causing an access beyond a buffer or to pass it two video streams in
which case it will just ignore one.
Attached patch fixes this.
In addition I would also suggest replacing all those "goto bail_out;" by
"return NULL" since they both do the same - while I gotos have their
use, I think in this case they are useless and confusing.

Reimar D?ffinger
-------------- next part --------------
Index: libavformat/dvenc.c
--- libavformat/dvenc.c	(revision 9003)
+++ libavformat/dvenc.c	(working copy)
@@ -298,9 +298,11 @@
     for (i=0; i<s->nb_streams; i++) {
          switch (s->streams[i]->codec->codec_type) {
          case CODEC_TYPE_VIDEO:
+             if (vst) return NULL; 
                vst = s->streams[i];
          case CODEC_TYPE_AUDIO:
+             if (c->n_ast > 1) return NULL; 
              c->ast[c->n_ast++] = s->streams[i];

More information about the ffmpeg-devel mailing list