From cbcc18bd9f9456c38bb4172749692bb5dbed12f5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 3 Dec 2013 04:08:37 +0100 Subject: [PATCH] avfilter/vf_pad: fix req_end Fixes out of array accesses Fixes Ticket3190 Signed-off-by: Michael Niedermayer (cherry picked from commit 0cc5011f9a1b05132f9a20a71feb031f30a8a53b) --- libavfilter/vf_pad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c index bb556c9403..45921057dd 100644 --- a/libavfilter/vf_pad.c +++ b/libavfilter/vf_pad.c @@ -251,7 +251,7 @@ static int buffer_needs_copy(PadContext *s, AVFrame *frame, AVBufferRef *buf) (s->y >> vsub) * frame->linesize[planes[i]]; ptrdiff_t req_end = ((s->w - s->x - frame->width) >> hsub) * s->draw.pixelstep[planes[i]] + - (s->y >> vsub) * frame->linesize[planes[i]]; + ((s->h - s->y - frame->height) >> vsub) * frame->linesize[planes[i]]; if (frame->linesize[planes[i]] < (s->w >> hsub) * s->draw.pixelstep[planes[i]]) return 1;