[FFmpeg-devel] [PATCH 1/6] buffersink: check that the API is called on the correct filter.

Michael Niedermayer michaelni at gmx.at
Mon Jun 25 00:46:57 CEST 2012


On Mon, Jun 25, 2012 at 12:35:55AM +0200, Nicolas George wrote:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/buffersink.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
> index 6423500..c1c6375 100644
> --- a/libavfilter/buffersink.c
> +++ b/libavfilter/buffersink.c
> @@ -39,6 +39,8 @@ typedef struct {
>      int64_t next_pts;            ///< interpolating audio pts
>  } BufferSinkContext;
>  
> +extern AVFilter avfilter_asink_abuffer;
> +
>  static av_cold void uninit(AVFilterContext *ctx)
>  {
>      BufferSinkContext *sink = ctx->priv;
> @@ -62,6 +64,7 @@ int av_buffersink_read(AVFilterContext *ctx, AVFilterBufferRef **buf)
>      AVFilterLink      *link = ctx->inputs[0];
>      int ret;
>  
> +    av_assert1(ctx->filter == &avfilter_asink_abuffer);

iam not 100% sure this is safe, &avfilter_asink_abuffer taken
from inside a lib and from a user app could differ thanks to copy
relocations. I dont know if there is a possible case where they could
mismatch for this here though ...

we had bugs in teh AVPacket destructor due to such checks in the past
already so i have a bad feeling ...
 
[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- 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/20120625/b01d73bb/attachment.asc>


More information about the ffmpeg-devel mailing list