aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/avf_showspectrum.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2013-04-29 13:31:04 +0000
committerPaul B Mahol <onemda@gmail.com>2013-04-29 19:27:15 +0000
commit32d464121959389bd266abe232896da09bbf2bd5 (patch)
tree0534515934487595f4cf6637598aa0977e36b764 /libavfilter/avf_showspectrum.c
parent22a86492ecd1f33506a960bc6af7b1a508998510 (diff)
downloadffmpeg-32d464121959389bd266abe232896da09bbf2bd5.tar.gz
lavfi/showspectrum: fix crash in case of negative linesize
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/avf_showspectrum.c')
-rw-r--r--libavfilter/avf_showspectrum.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 058f22c919..7cd75dfe0d 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, outlink->w);
+ memset(outpicref->data[1] + i * outpicref->linesize[1], 128, outlink->w);
+ memset(outpicref->data[2] + i * outpicref->linesize[2], 128, outlink->w);
+ }
}
if (showspectrum->xpos >= outlink->w)