[FFmpeg-devel] [PATCH] fix ffserver's SIGSEGV

Maksym Veremeyenko verem at m1stereo.tv
Tue May 10 15:02:08 CEST 2011


i just realize, that there are at least two places that need to be fixed

first, allocating streams array:

diff --git a/ffserver.c b/ffserver.c
index 83f984b..7a9af4f 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -2231,6 +2231,8 @@ static int http_prepare_data(HTTPContext *c)
          av_metadata_set2(&c->fmt_ctx.metadata, "copyright", 
c->stream->copyright, 0);
          av_metadata_set2(&c->fmt_ctx.metadata, "title"    , 
c->stream->title    , 0);

+        c->fmt_ctx.streams = av_mallocz(sizeof(AVStream*) * 
c->stream->nb_streams);
+
          for(i=0;i<c->stream->nb_streams;i++) {
              AVStream *st;
              AVStream *src;

but i have no idea where to free allocated mem.

second, allocating streams in a read_ffserver_streams function:

diff --git a/ffmpeg.c b/ffmpeg.c
index aa3c33d..ddacbea 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -708,6 +708,7 @@ static int read_ffserver_streams(AVFormatContext *s, 
const char *filename)
          return err;
      /* copy stream format */
      s->nb_streams = 0;
+    s->streams = av_mallocz(sizeof(AVStream*) * ic->nb_streams);
      for(i=0;i<ic->nb_streams;i++) {
          AVStream *st;
          AVCodec *codec;

but it cause:

*** glibc detected *** ./ffmpeg_g: corrupted double-linked list: 
0x08a891b0 ***



-- 
________________________________________
Maksym Veremeyenko


More information about the ffmpeg-devel mailing list