[FFmpeg-devel] [PATCH 1/2] lavfi/showspectrum: fix crash in case of negative linesize
Paul B Mahol
onemda at gmail.com
Mon Apr 29 15:39:44 CEST 2013
Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
libavfilter/avf_showspectrum.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 058f22c..c87812f 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -211,9 +211,11 @@ static int config_output(AVFilterLink *outlink)
if (!outpicref)
return AVERROR(ENOMEM);
outlink->sample_aspect_ratio = (AVRational){1,1};
- memset(outpicref->data[0], 0, outlink->h * outpicref->linesize[0]);
- memset(outpicref->data[1], 128, outlink->h * outpicref->linesize[1]);
- memset(outpicref->data[2], 128, outlink->h * outpicref->linesize[2]);
+ for (i = 0; i < outlink->h; i++) {
+ memset(outpicref->data[0] + i * outpicref->linesize[0], 0, FFABS(outpicref->linesize[0]));
+ memset(outpicref->data[1] + i * outpicref->linesize[1], 128, FFABS(outpicref->linesize[1]));
+ memset(outpicref->data[2] + i * outpicref->linesize[2], 128, FFABS(outpicref->linesize[2]));
+ }
}
if (showspectrum->xpos >= outlink->w)
--
1.7.11.2
More information about the ffmpeg-devel
mailing list