avfilter/avf_showwaves: Check max_samples

Fixes potential division by zero
Fixes: CID1292295

Reviewed-by: Ganesh Ajjanagadde <gajjanag@mit.edu>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/149/head
Michael Niedermayer 9 years ago
parent dd7b486e8e
commit a212a983c7
  1. 5
      libavfilter/avf_showwaves.c

@ -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);

Loading…
Cancel
Save