This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch release/8.0
in repository ffmpeg.

commit d76eab5dabe0ae4b2f8c54e97bc565adbd926c5f
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sat May 2 12:22:34 2026 +0200
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Sun May 3 19:57:04 2026 +0200

    avfilter/vf_codecview: Clamp block to the visible frame region
    
    Fixes: write into the padding area of the frame
    
    Found-by: Marius Momeu <[email protected]>
    Signed-off-by: Michael Niedermayer <[email protected]>
    (cherry picked from commit c568f40597fc8a0a462fa08ed7d9de49c02cd80e)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavfilter/vf_codecview.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c
index a4a701b00c..f20056b91b 100644
--- a/libavfilter/vf_codecview.c
+++ b/libavfilter/vf_codecview.c
@@ -266,9 +266,22 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
             if (par->nb_blocks) {
                 for (int block_idx = 0; block_idx < par->nb_blocks; 
block_idx++) {
                     AVVideoBlockParams *b = av_video_enc_params_block(par, 
block_idx);
-                    uint8_t *buf = frame->data[0] + b->src_y * stride;
 
-                    draw_block_rectangle(buf, b->src_x, b->src_y, b->w, b->h, 
stride, 100);
+                    int64_t x0 = b->src_x;
+                    int64_t y0 = b->src_y;
+                    int64_t x1 = x0 + b->w;
+                    int64_t y1 = y0 + b->h;
+
+                    x0 = FFMAX(x0, 0);
+                    y0 = FFMAX(y0, 0);
+                    x1 = FFMIN(x1, frame->width);
+                    y1 = FFMIN(y1, frame->height);
+
+                    if (x1 <= x0 || y1 <= y0)
+                        continue;
+
+                    uint8_t *buf = frame->data[0] + y0 * stride;
+                    draw_block_rectangle(buf, x0, y0, x1-x0, y1-y0, stride, 
100);
                 }
             }
         }

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to