[FFmpeg-devel] [PATCH 2/2] lavfi/showwaves: fix crash in case of negative linesize

Paul B Mahol onemda at gmail.com
Mon Apr 29 15:39:45 CEST 2013


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavfilter/avf_showwaves.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c
index 5e89146..aa0cf80 100644
--- a/libavfilter/avf_showwaves.c
+++ b/libavfilter/avf_showwaves.c
@@ -188,7 +188,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
                                           (AVRational){ 1, inlink->sample_rate },
                                           outlink->time_base);
             linesize = outpicref->linesize[0];
-            memset(outpicref->data[0], 0, showwaves->h*linesize);
+            for (j = 0; j < outlink->h; j++)
+                memset(outpicref->data[0] + j * linesize, 0, FFABS(linesize));
         }
         for (j = 0; j < nb_channels; j++) {
             h = showwaves->h/2 - av_rescale(*p++, showwaves->h/2, MAX_INT16);
-- 
1.7.11.2



More information about the ffmpeg-devel mailing list