Commit a212a983 authored by Michael Niedermayer's avatar Michael Niedermayer

avfilter/avf_showwaves: Check max_samples

Fixes potential division by zero
Fixes: CID1292295
Reviewed-by: 's avatarGanesh Ajjanagadde <gajjanag@mit.edu>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent dd7b486e
...@@ -203,6 +203,11 @@ static int push_single_pic(AVFilterLink *outlink) ...@@ -203,6 +203,11 @@ static int push_single_pic(AVFilterLink *outlink)
int col = 0; int col = 0;
int64_t *sum = showwaves->sum; int64_t *sum = showwaves->sum;
if (max_samples == 0) {
av_log(ctx, AV_LOG_ERROR, "Too few samples\n");
return AVERROR(EINVAL);
}
av_log(ctx, AV_LOG_DEBUG, "Create frame averaging %"PRId64" samples per column\n", max_samples); av_log(ctx, AV_LOG_DEBUG, "Create frame averaging %"PRId64" samples per column\n", max_samples);
memset(sum, 0, nb_channels); memset(sum, 0, nb_channels);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment