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

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

commit 0066b79680327fb5fb8759348ea40d7f07e6a3bb
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sun Sep 6 01:57:34 2026 +0200
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Thu Sep 17 01:30:42 2026 +0200

    swscale/ops_dispatch: account for the vertical filter taps in the tail copy
    
    Fixes: out of array read
    Fixes: ffmpeg -cpuflags 0 -i poc_input.ppm -vf scale=17:17:flags=unstable 
-pix_fmt rgba -f rawvideo -
    Fixes: sAlT1ubFAGko
    (cherry picked from commit 32304f6cb481e216f1a941aadd6c8d1c2e7a27df)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libswscale/ops_dispatch.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/libswscale/ops_dispatch.c b/libswscale/ops_dispatch.c
index e04c0be90a..3b22980b17 100644
--- a/libswscale/ops_dispatch.c
+++ b/libswscale/ops_dispatch.c
@@ -54,6 +54,7 @@ typedef struct SwsOpPass {
     int palette_idx;
     int *offsets_y;
     int filter_size_h;
+    int filter_size_v;
     bool memcpy_first;
     bool memcpy_last;
     bool memcpy_out;
@@ -166,7 +167,7 @@ static inline int get_lines_in(const SwsOpPass *p, const 
int y, const int h,
         return h >> base->in_sub_y[plane];
 
     const int y0 = p->offsets_y[y] >> base->in_sub_y[plane];
-    const int y1 = p->offsets_y[y + h - 1] >> base->in_sub_y[plane];
+    const int y1 = (p->offsets_y[y + h - 1] + p->filter_size_v - 1) >> 
base->in_sub_y[plane];
     return y1 - y0 + 1;
 }
 
@@ -400,8 +401,11 @@ static void op_pass_run(const SwsFrame *out, const 
SwsFrame *in, const int y,
      *    memcpy the last column on the output side if unpadded.
      */
 
-    const bool memcpy_in  = p->memcpy_last && y + h == pass->lines ||
-                            p->memcpy_first && y == 0;
+    const int y_in_first = p->offsets_y ? p->offsets_y[y] : y;
+    const int y_in_last  = p->offsets_y ? p->offsets_y[y + h - 1] + 
p->filter_size_v - 1
+                                        : y + h - 1;
+    const bool memcpy_in  = p->memcpy_last && y_in_last == in->height - 1 ||
+                            p->memcpy_first && y_in_first == 0;
     const bool memcpy_out = p->memcpy_out;
     const size_t num_blocks  = p->num_blocks;
     const size_t tail_blocks = p->tail_blocks;
@@ -435,7 +439,7 @@ static void op_pass_run(const SwsFrame *out, const SwsFrame 
*in, const int y,
         /* Input offsets are relative to the base pointer */
         if (!exec.in_offset_x || memcpy_in)
             exec.in[i] += p->tail_off_in;
-        tail.in[i] += y * tail.in_stride[i];
+        tail.in[i] += (y_in_first >> exec.in_sub_y[i]) * tail.in_stride[i];
     }
     for (int i = 0; i < p->planes_out; i++) {
         exec.out[i] += p->tail_off_out;
@@ -611,6 +615,7 @@ static int compile_single(const CompileArgs *args, const 
SwsOpList *ops,
     const SwsFilterWeights *filter = read ? read->rw.filter.kernel : NULL;
     if (read && read->rw.filter.op == SWS_OP_FILTER_V) {
         p->offsets_y = av_refstruct_ref(filter->offsets);
+        p->filter_size_v = filter->filter_size;
 
         /* Compute relative pointer bumps for each output line */
         int32_t *bump = av_malloc_array(filter->dst_size, sizeof(*bump));

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to