[FFmpeg-devel] [PATCH] sink_buffer: copy list of provided formats in the context

Stefano Sabatini stefasab at gmail.com
Thu Dec 22 10:14:43 CET 2011


On date Tuesday 2011-12-20 16:15:04 +0100, Michael Niedermayer encoded:
> On Tue, Dec 20, 2011 at 01:37:24PM +0100, Stefano Sabatini wrote:
> > A list of formats may have been dynamically created by the calling code,
> > and thus should not be referenced by the sink buffer context.
> > 
> > Avoid possible invalid data reference.
> > ---
> >  libavfilter/formats.c     |   26 ++++++++++++++++++++++++++
> >  libavfilter/internal.h    |   12 ++++++++++++
> >  libavfilter/sink_buffer.c |   45 ++++++++++++++++++++++++++++++++++-----------
> >  3 files changed, 72 insertions(+), 11 deletions(-)
> > 
> > diff --git a/libavfilter/formats.c b/libavfilter/formats.c
> > index ff4d49d..4743a81 100644
> > --- a/libavfilter/formats.c
> > +++ b/libavfilter/formats.c
> > @@ -93,6 +93,32 @@ int ff_fmt_is_in(int fmt, const int *fmts)
> >      return 0;
> >  }
> >  
> > +#define COPY_INT_LIST(list_copy, list, type) {                          \
> > +    int count = 0;                                                      \
> > +    if (list)                                                           \
> > +        for (count = 0; list[count] != -1; count++)                     \
> > +            ;                                                           \
> 
> > +    list_copy = av_malloc((count+1) * sizeof(type));                    \
> 
> av_calloc()
> 
> otherwise LGTM

Applied.
-- 
FFmpeg = Fascinating and Freak Magical Proud Extroverse God


More information about the ffmpeg-devel mailing list