diff mbox series

[FFmpeg-devel,v2] avcodec/noise_bsf: Check for wrapped frames

Message ID 20230604195322.26982-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,v2] avcodec/noise_bsf: Check for wrapped frames | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer June 4, 2023, 7:53 p.m. UTC
Wrapped frames contain pointers so they need specific code to
noise them, the generic code would lead to segfaults

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/noise_bsf.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Anton Khirnov June 5, 2023, 10:21 a.m. UTC | #1
Quoting Michael Niedermayer (2023-06-04 21:53:22)
> Wrapped frames contain pointers so they need specific code to
> noise them, the generic code would lead to segfaults
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/noise_bsf.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c
> index 168f3aa373..2985a8ec4f 100644
> --- a/libavcodec/noise_bsf.c
> +++ b/libavcodec/noise_bsf.c
> @@ -86,6 +86,13 @@ static int noise_init(AVBSFContext *ctx)
>              return AVERROR(ENOMEM);
>      }
>  
> +    if (ctx->par_in->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME &&
> +        strcmp(s->amount_str, "0")
> +    ) {

Why is this on a separate line?
Michael Niedermayer June 5, 2023, 10:09 p.m. UTC | #2
On Mon, Jun 05, 2023 at 12:21:13PM +0200, Anton Khirnov wrote:
> Quoting Michael Niedermayer (2023-06-04 21:53:22)
> > Wrapped frames contain pointers so they need specific code to
> > noise them, the generic code would lead to segfaults
> > 
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/noise_bsf.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c
> > index 168f3aa373..2985a8ec4f 100644
> > --- a/libavcodec/noise_bsf.c
> > +++ b/libavcodec/noise_bsf.c
> > @@ -86,6 +86,13 @@ static int noise_init(AVBSFContext *ctx)
> >              return AVERROR(ENOMEM);
> >      }
> >  
> > +    if (ctx->par_in->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME &&
> > +        strcmp(s->amount_str, "0")
> > +    ) {
> 
> Why is this on a separate line?

Probably because i pressed the enter key. Ill remove the \n

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c
index 168f3aa373..2985a8ec4f 100644
--- a/libavcodec/noise_bsf.c
+++ b/libavcodec/noise_bsf.c
@@ -86,6 +86,13 @@  static int noise_init(AVBSFContext *ctx)
             return AVERROR(ENOMEM);
     }
 
+    if (ctx->par_in->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME &&
+        strcmp(s->amount_str, "0")
+    ) {
+        av_log(ctx, AV_LOG_ERROR, "Wrapped AVFrame noising is unsupported\n");
+        return AVERROR_PATCHWELCOME;
+    }
+
     ret = av_expr_parse(&s->amount_pexpr, s->amount_str,
                         var_names, NULL, NULL, NULL, NULL, 0, ctx);
     if (ret < 0) {