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 e313d8d4435d212a1a502895e042d2a654eef056
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Tue Feb 24 23:37:21 2026 +0100
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Tue May 5 18:55:05 2026 +0200

    avfilter/vf_convolution: Use avpriv_mirror
    
    Fixes: out of array read
    Fixes: #YWH-PGM40646-35
    
    Found-by: jpraveenrao
    Signed-off-by: Michael Niedermayer <[email protected]>
    (cherry picked from commit 8970658472d1cb62d663ece0b6cacf4a1f465da3)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavfilter/convolution.h    |  1 +
 libavfilter/vf_convolution.c | 22 ++++++----------------
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/libavfilter/convolution.h b/libavfilter/convolution.h
index 88aabe9a20..8a8b85fae8 100644
--- a/libavfilter/convolution.h
+++ b/libavfilter/convolution.h
@@ -21,6 +21,7 @@
 #ifndef AVFILTER_CONVOLUTION_H
 #define AVFILTER_CONVOLUTION_H
 #include "avfilter.h"
+#include "libavutil/internal.h"
 
 enum MatrixMode {
     MATRIX_SQUARE,
diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c
index 3092c23402..6303cc6e8f 100644
--- a/libavfilter/vf_convolution.c
+++ b/libavfilter/vf_convolution.c
@@ -534,11 +534,8 @@ static void setup_5x5(int radius, const uint8_t *c[], 
const uint8_t *src, int st
     int i;
 
     for (i = 0; i < 25; i++) {
-        int xoff = FFABS(x + ((i % 5) - 2));
-        int yoff = FFABS(y + (i / 5) - 2);
-
-        xoff = xoff >= w ? 2 * w - 1 - xoff : xoff;
-        yoff = yoff >= h ? 2 * h - 1 - yoff : yoff;
+        int xoff = avpriv_mirror(x + (i % 5) - 2, w - 1);
+        int yoff = avpriv_mirror(y + (i / 5) - 2, h - 1);
 
         c[i] = src + xoff * bpc + yoff * stride;
     }
@@ -550,11 +547,8 @@ static void setup_7x7(int radius, const uint8_t *c[], 
const uint8_t *src, int st
     int i;
 
     for (i = 0; i < 49; i++) {
-        int xoff = FFABS(x + ((i % 7) - 3));
-        int yoff = FFABS(y + (i / 7) - 3);
-
-        xoff = xoff >= w ? 2 * w - 1 - xoff : xoff;
-        yoff = yoff >= h ? 2 * h - 1 - yoff : yoff;
+        int xoff = avpriv_mirror(x + (i % 7) - 3, w - 1);
+        int yoff = avpriv_mirror(y + (i / 7) - 3, h - 1);
 
         c[i] = src + xoff * bpc + yoff * stride;
     }
@@ -566,9 +560,7 @@ static void setup_row(int radius, const uint8_t *c[], const 
uint8_t *src, int st
     int i;
 
     for (i = 0; i < radius * 2 + 1; i++) {
-        int xoff = FFABS(x + i - radius);
-
-        xoff = xoff >= w ? 2 * w - 1 - xoff : xoff;
+        int xoff = avpriv_mirror(x + i - radius, w - 1);
 
         c[i] = src + xoff * bpc + y * stride;
     }
@@ -580,9 +572,7 @@ static void setup_column(int radius, const uint8_t *c[], 
const uint8_t *src, int
     int i;
 
     for (i = 0; i < radius * 2 + 1; i++) {
-        int xoff = FFABS(x + i - radius);
-
-        xoff = xoff >= h ? 2 * h - 1 - xoff : xoff;
+        int xoff = avpriv_mirror(x + i - radius, h - 1);
 
         c[i] = src + y * bpc + xoff * stride;
     }

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

Reply via email to