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

Michael Niedermayer michaelni at gmx.at
Tue Dec 20 16:15:04 CET 2011


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

[..]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There seems to be only one solution to NIH syndrom, ... a shooting squad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111220/7c201a2a/attachment.asc>


More information about the ffmpeg-devel mailing list