This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch release/4.4 in repository ffmpeg.
commit 6646c3e381000eabed9c0f46f2184578f3ce146c Author: Michael Niedermayer <[email protected]> AuthorDate: Wed Jan 7 20:48:34 2026 +0100 Commit: Michael Niedermayer <[email protected]> CommitDate: Tue May 5 18:54:55 2026 +0200 avfilter/vf_find_rect: Fix handling odd sized images Fixes: out of array read Fixes: #YWH-PGM40646-17 Found-by: An0n99X Signed-off-by: Michael Niedermayer <[email protected]> (cherry picked from commit f99df7dbb3043f0b0b1d5de6ce33971645331313) Signed-off-by: Michael Niedermayer <[email protected]> --- libavfilter/vf_find_rect.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_find_rect.c b/libavfilter/vf_find_rect.c index b5f8fbcba6..fc5eafb149 100644 --- a/libavfilter/vf_find_rect.c +++ b/libavfilter/vf_find_rect.c @@ -87,8 +87,10 @@ static AVFrame *downscale(AVFrame *in) src = in ->data[0]; dst = frame->data[0]; - for(y = 0; y < frame->height; y++) { - for(x = 0; x < frame->width; x++) { + int w2 = in->width/2; + int h2 = in->height/2; + for(y = 0; y < h2; y++) { + for(x = 0; x < w2; x++) { dst[x] = ( src[2*x+0] + src[2*x+1] + src[2*x+0 + in->linesize[0]] @@ -98,6 +100,22 @@ static AVFrame *downscale(AVFrame *in) src += 2*in->linesize[0]; dst += frame->linesize[0]; } + src = in ->data[0]; + dst = frame->data[0]; + for(y = 0; y < frame->height; y++) { + int yd = y < h2 ? in->linesize[0] : 0; + x = yd ? w2 : 0; + for(; x < frame->width; x++) { + dst[x] = ( src[2*x+0] + + src[FFMIN(2*x+1, w2)] + + src[2*x+0 + yd] + + src[FFMIN(2*x+1, w2) + yd] + + 2) >> 2; + } + src += 2*in->linesize[0]; + dst += frame->linesize[0]; + } + return frame; } _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
