[FFmpeg-cvslog] avfilter/avf_showwaves: Check max_samples

Michael Niedermayer git at videolan.org
Thu Sep 3 19:42:16 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Sep  3 14:52:18 2015 +0200| [a212a983c7f4faf06e600f32a165592dc5b6ae76] | committer: Michael Niedermayer

avfilter/avf_showwaves: Check max_samples

Fixes potential division by zero
Fixes: CID1292295

Reviewed-by: Ganesh Ajjanagadde <gajjanag at mit.edu>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a212a983c7f4faf06e600f32a165592dc5b6ae76
---

 libavfilter/avf_showwaves.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c
index 57a6b2e..a19acf5 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);



More information about the ffmpeg-cvslog mailing list