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@niedermayer.cc>
This commit is contained in:
Paul B Mahol 2023-12-20 09:48:19 +01:00 committed by Michael Niedermayer
parent e4d2666bdc
commit e6459abfad
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

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