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

Michael Niedermayer michael at niedermayer.cc
Sun Jun 4 21:07:25 EEST 2023


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 at niedermayer.cc>
---
 libavcodec/noise_bsf.c | 5 +++++
 1 file changed, 5 insertions(+)

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)
-- 
2.17.1



More information about the ffmpeg-devel mailing list