[FFmpeg-cvslog] avfilter/af_stereotools: round-up max size of buffer

Paul B Mahol git at videolan.org
Fri Dec 29 03:11:31 EET 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Dec 20 09:48:19 2023 +0100| [e6459abfadabb43cdc4c807975e1a854da23644d] | committer: Michael Niedermayer

avfilter/af_stereotools: round-up max size of buffer

Fixes: out of array access
Fixes: tickets/10747/poc14ffmpeg

Found-by: Zeng Yunxiang and Song Jiaxuan
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e6459abfadabb43cdc4c807975e1a854da23644d
---

 libavfilter/af_stereotools.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/af_stereotools.c b/libavfilter/af_stereotools.c
index 4bcd696cf9..915edecc53 100644
--- a/libavfilter/af_stereotools.c
+++ b/libavfilter/af_stereotools.c
@@ -119,7 +119,7 @@ static int config_input(AVFilterLink *inlink)
     AVFilterContext *ctx = inlink->dst;
     StereoToolsContext *s = ctx->priv;
 
-    s->length = FFALIGN(inlink->sample_rate / 10, 2);
+    s->length = FFALIGN((inlink->sample_rate + 9) / 10, 2);
     if (!s->buffer)
         s->buffer = av_calloc(s->length, sizeof(*s->buffer));
     if (!s->buffer)



More information about the ffmpeg-cvslog mailing list