summaryrefslogtreecommitdiff
path: root/libavfilter/af_aphaser.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavfilter/af_aphaser.c')
-rw-r--r--libavfilter/af_aphaser.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavfilter/af_aphaser.c b/libavfilter/af_aphaser.c
index b08570f90a..582f6e7981 100644
--- a/libavfilter/af_aphaser.c
+++ b/libavfilter/af_aphaser.c
@@ -206,6 +206,10 @@ static int config_output(AVFilterLink *outlink)
AVFilterLink *inlink = outlink->src->inputs[0];
p->delay_buffer_length = p->delay * 0.001 * inlink->sample_rate + 0.5;
+ if (p->delay_buffer_length <= 0) {
+ av_log(outlink->src, AV_LOG_ERROR, "delay is too small\n");
+ return AVERROR(EINVAL);
+ }
p->delay_buffer = av_calloc(p->delay_buffer_length, sizeof(*p->delay_buffer) * inlink->channels);
p->modulation_buffer_length = inlink->sample_rate / p->speed + 0.5;
p->modulation_buffer = av_malloc_array(p->modulation_buffer_length, sizeof(*p->modulation_buffer));