aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2020-12-25 14:07:25 +0100
committerPaul B Mahol <onemda@gmail.com>2020-12-25 14:12:52 +0100
commit4848eb48ac588620ae8e32467129e396bf71a718 (patch)
tree8d91a5fa1cb8e764779a38c13ade2c9e6a6e71e3
parent38e71d8b6c55f56ef58f1acb1c8d9e12a65e0a1d (diff)
downloadffmpeg-4848eb48ac588620ae8e32467129e396bf71a718.tar.gz
avfilter/af_vibrato: make sure table size is at least 1
Fixes overreads.
-rw-r--r--libavfilter/af_vibrato.c4
1 files 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);