diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-09-03 14:52:18 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-09-03 19:27:20 +0200 |
commit | a212a983c7f4faf06e600f32a165592dc5b6ae76 (patch) | |
tree | 4ffb3eb3dc706829c8040153e5f0a09e1d7a6b21 | |
parent | dd7b486e8e5bc12777d19c7932fa2a830db5a826 (diff) | |
download | ffmpeg-a212a983c7f4faf06e600f32a165592dc5b6ae76.tar.gz |
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>
-rw-r--r-- | libavfilter/avf_showwaves.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c index 57a6b2e149..a19acf54b9 100644 --- a/libavfilter/avf_showwaves.c +++ b/libavfilter/avf_showwaves.c @@ -203,6 +203,11 @@ static int push_single_pic(AVFilterLink *outlink) int col = 0; 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); memset(sum, 0, nb_channels); |