History

avfilter/af_vibrato: make sure table size is at least 1

Fixes overreads.

Paul B Mahol committed 5 years ago

Commit 4848eb41 parent 38e71d81 file · +2 −2Browse files

Unified · Split

libavfilter/af_vibrato.c+2−2
@@ -162,7 +162,7 @@ static int config_input(AVFilterLink *inlink) · 161 unmodified lines
162 s->buf = av_calloc(inlink->channels, sizeof(*s->buf));162 s->buf = av_calloc(inlink->channels, sizeof(*s->buf));
163 if (!s->buf)163 if (!s->buf)
164 return AVERROR(ENOMEM);164 return AVERROR(ENOMEM);
165 s->buf_size = inlink->sample_rate * 0.005;165 s->buf_size = lrint(inlink->sample_rate * 0.005 + 0.5);
166 for (c = 0; c < s->channels; c++) {166 for (c = 0; c < s->channels; c++) {
167 s->buf[c] = av_malloc_array(s->buf_size, sizeof(*s->buf[c]));167 s->buf[c] = av_malloc_array(s->buf_size, sizeof(*s->buf[c]));
168 if (!s->buf[c])168 if (!s->buf[c])
@@ -170,7 +170,7 @@ static int config_input(AVFilterLink *inlink) · 1 unmodified line
170 }170 }
171 s->buf_index = 0;171 s->buf_index = 0;
172 172
173 s->wave_table_size = inlink->sample_rate / s->freq;173 s->wave_table_size = lrint(inlink->sample_rate / s->freq + 0.5);
174 s->wave_table = av_malloc_array(s->wave_table_size, sizeof(*s->wave_table));174 s->wave_table = av_malloc_array(s->wave_table_size, sizeof(*s->wave_table));
175 if (!s->wave_table)175 if (!s->wave_table)
176 return AVERROR(ENOMEM);176 return AVERROR(ENOMEM);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t