[FFmpeg-cvslog] avfilter/af_vibrato: make sure table size is at least 1
Paul B Mahol
git at videolan.org
Fri Dec 25 15:14:34 EET 2020
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Dec 25 14:07:25 2020 +0100| [4848eb48ac588620ae8e32467129e396bf71a718] | committer: Paul B Mahol
avfilter/af_vibrato: make sure table size is at least 1
Fixes overreads.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4848eb48ac588620ae8e32467129e396bf71a718
---
libavfilter/af_vibrato.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavfilter/af_vibrato.c b/libavfilter/af_vibrato.c
index 22bbab6239..5db1f0f6c9 100644
--- a/libavfilter/af_vibrato.c
+++ b/libavfilter/af_vibrato.c
@@ -162,7 +162,7 @@ static int config_input(AVFilterLink *inlink)
s->buf = av_calloc(inlink->channels, sizeof(*s->buf));
if (!s->buf)
return AVERROR(ENOMEM);
- s->buf_size = inlink->sample_rate * 0.005;
+ s->buf_size = lrint(inlink->sample_rate * 0.005 + 0.5);
for (c = 0; c < s->channels; c++) {
s->buf[c] = av_malloc_array(s->buf_size, sizeof(*s->buf[c]));
if (!s->buf[c])
@@ -170,7 +170,7 @@ static int config_input(AVFilterLink *inlink)
}
s->buf_index = 0;
- s->wave_table_size = inlink->sample_rate / s->freq;
+ s->wave_table_size = lrint(inlink->sample_rate / s->freq + 0.5);
s->wave_table = av_malloc_array(s->wave_table_size, sizeof(*s->wave_table));
if (!s->wave_table)
return AVERROR(ENOMEM);
More information about the ffmpeg-cvslog
mailing list