[FFmpeg-soc] [soc]: r4802 - in concat/libavformat: concatgen.c playlist.c

gkovacs subversion at mplayerhq.hu
Fri Jul 24 03:01:48 CEST 2009


Author: gkovacs
Date: Fri Jul 24 03:01:48 2009
New Revision: 4802

Log:
allocate large enough block to store null terminator

Modified:
   concat/libavformat/concatgen.c
   concat/libavformat/playlist.c

Modified: concat/libavformat/concatgen.c
==============================================================================
--- concat/libavformat/concatgen.c	Fri Jul 24 02:56:25 2009	(r4801)
+++ concat/libavformat/concatgen.c	Fri Jul 24 03:01:48 2009	(r4802)
@@ -65,8 +65,8 @@ int ff_concatgen_read_packet(AVFormatCon
             // -32 AVERROR_EOF for avi, -51 for ogg
                 av_log(ic, AV_LOG_DEBUG, "Switching stream %d to %d\n", stream_index, ctx->pe_curidx+1);
                 ctx->time_offset += av_rescale_q(ic->cur_st->duration, ic->cur_st->time_base, AV_TIME_BASE_Q);
-                ++ctx->pe_curidx;
-                ff_playlist_populate_context(s);
+                if (!ctx->icl[++ctx->pe_curidx])
+                    ff_playlist_populate_context(s);
                 have_switched_streams = 1;
                 continue;
             } else {

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Fri Jul 24 02:56:25 2009	(r4801)
+++ concat/libavformat/playlist.c	Fri Jul 24 03:01:48 2009	(r4802)
@@ -52,7 +52,7 @@ void ff_playlist_populate_context(AVForm
     int i;
     AVFormatContext *ic;
     PlaylistContext *ctx = s->priv_data;
-    ctx->icl = av_realloc(ctx->icl, sizeof(*(ctx->icl)) * (ctx->pe_curidx+1));
+    ctx->icl = av_realloc(ctx->icl, sizeof(*(ctx->icl)) * (ctx->pe_curidx+2));
     ctx->icl[ctx->pe_curidx+1] = NULL;
     ic = ctx->icl[ctx->pe_curidx] = ff_playlist_alloc_formatcontext(ctx->flist[ctx->pe_curidx]);
     ic->iformat->read_header(ic, 0);
@@ -134,7 +134,7 @@ PlaylistContext *ff_playlist_from_encode
 
 void ff_playlist_add_path(PlaylistContext *ctx, char *itempath)
 {
-    ctx->flist = av_realloc(ctx->flist, sizeof(*(ctx->flist)) * ++ctx->pelist_size);
+    ctx->flist = av_realloc(ctx->flist, sizeof(*(ctx->flist)) * (++ctx->pelist_size+1));
     ctx->flist[ctx->pelist_size] = NULL;
     ctx->flist[ctx->pelist_size-1] = itempath;
 }


More information about the FFmpeg-soc mailing list