diff mbox series

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

Message ID 20230604180725.24695-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel] 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, 6:07 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 | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Michael Niedermayer June 4, 2023, 6:13 p.m. UTC | #1
On Sun, Jun 04, 2023 at 08:07:25PM +0200, Michael Niedermayer wrote:
> 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 | 5 +++++
>  1 file changed, 5 insertions(+)

I intend to apply this soon as noising pointers is not too good

[...]
Gyan Doshi June 4, 2023, 6:36 p.m. UTC | #2
On 2023-06-04 11:43 pm, Michael Niedermayer wrote:
> On Sun, Jun 04, 2023 at 08:07:25PM +0200, Michael Niedermayer wrote:
>> 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 | 5 +++++
>>   1 file changed, 5 insertions(+)
> I intend to apply this soon as noising pointers is not too good

Their contents can't be manipulated but they can still be dropped 
conditionally, so the bsf can still handle them if amount_str is NULL.

Regards,
Gyan
Michael Niedermayer June 4, 2023, 7:54 p.m. UTC | #3
On Mon, Jun 05, 2023 at 12:06:15AM +0530, Gyan Doshi wrote:
> 
> 
> On 2023-06-04 11:43 pm, Michael Niedermayer wrote:
> > On Sun, Jun 04, 2023 at 08:07:25PM +0200, Michael Niedermayer wrote:
> > > 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 | 5 +++++
> > >   1 file changed, 5 insertions(+)
> > I intend to apply this soon as noising pointers is not too good
> 
> Their contents can't be manipulated but they can still be dropped
> conditionally, so the bsf can still handle them if amount_str is NULL.

ok, ive sent a new patch

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c
index 168f3aa373..8c30ab48ab 100644
--- a/libavcodec/noise_bsf.c
+++ b/libavcodec/noise_bsf.c
@@ -80,6 +80,11 @@  static int noise_init(AVBSFContext *ctx)
     NoiseContext *s = ctx->priv_data;
     int ret;
 
+    if (ctx->par_in->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME) {
+        av_log(ctx, AV_LOG_ERROR, "Wrapped AVFrame noising is unsupported\n");
+        return AVERROR_PATCHWELCOME;
+    }
+
     if (!s->amount_str) {
         s->amount_str = (!s->drop_str && !s->dropamount) ? av_strdup("-1") : av_strdup("0");
         if (!s->amount_str)