[FFmpeg-devel] [PATCH 1/2] avfilter/af_stereowiden: Check length

Michael Niedermayer michael at niedermayer.cc
Sun Dec 24 03:49:48 EET 2023


Fixes: out of array access
Fixes: tickets/10746/poc13ffmpeg

Found-by: Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavfilter/af_stereowiden.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/af_stereowiden.c b/libavfilter/af_stereowiden.c
index af4b23e8a57..f7a6a91ae40 100644
--- a/libavfilter/af_stereowiden.c
+++ b/libavfilter/af_stereowiden.c
@@ -74,6 +74,8 @@ static int config_input(AVFilterLink *inlink)
 
     s->length = s->delay * inlink->sample_rate / 1000;
     s->length *= 2;
+    if (s->length == 0)
+        return AVERROR(EINVAL);
     s->buffer = av_calloc(s->length, sizeof(*s->buffer));
     if (!s->buffer)
         return AVERROR(ENOMEM);
-- 
2.17.1



More information about the ffmpeg-devel mailing list