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

Git pushed a commit to branch master
in repository ffmpeg.

commit e24b9820b46e74eb8c50eb23c9d34cae2b0dbf45
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Wed Feb 25 00:44:41 2026 +0100
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Fri Mar 6 03:21:37 2026 +0100

    avfilter/vf_convolution: Handle corner cases with small frames
    
    Fixes: out of array read
    Fixes: #YWH-PGM40646-35
    
    Found-by: jpraveenrao
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavfilter/vf_convolution.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c
index f0d2cec78e..7a27bdba20 100644
--- a/libavfilter/vf_convolution.c
+++ b/libavfilter/vf_convolution.c
@@ -604,10 +604,12 @@ static int filter_slice(AVFilterContext *ctx, void *arg, 
int jobnr, int nb_jobs)
             continue;
         }
         for (y = slice_start; y < slice_end; y += step) {
-            const int xoff = mode == MATRIX_COLUMN ? (y - slice_start) * bpc : 
radius * bpc;
-            const int yoff = mode == MATRIX_COLUMN ? radius * dstride : 0;
+            const int left = FFMIN(radius, sizew);
+            const int right = FFMAX(left, sizew - radius);
+            const int xoff = mode == MATRIX_COLUMN ? (y - slice_start) * bpc : 
left * bpc;
+            const int yoff = mode == MATRIX_COLUMN ? left * dstride : 0;
 
-            for (x = 0; x < radius; x++) {
+            for (x = 0; x < left; x++) {
                 const int xoff = mode == MATRIX_COLUMN ? (y - slice_start) * 
bpc : x * bpc;
                 const int yoff = mode == MATRIX_COLUMN ? x * dstride : 0;
 
@@ -616,11 +618,11 @@ static int filter_slice(AVFilterContext *ctx, void *arg, 
int jobnr, int nb_jobs)
                                  bias, matrix, c, s->max, radius,
                                  dstride, stride, slice_end - step);
             }
-            s->setup[plane](radius, c, src, stride, radius, width, y, height, 
bpc);
-            s->filter[plane](dst + yoff + xoff, sizew - 2 * radius,
+            s->setup[plane](radius, c, src, stride, left, width, y, height, 
bpc);
+            s->filter[plane](dst + yoff + xoff, right - left,
                              rdiv, bias, matrix, c, s->max, radius,
                              dstride, stride, slice_end - step);
-            for (x = sizew - radius; x < sizew; x++) {
+            for (x = right; x < sizew; x++) {
                 const int xoff = mode == MATRIX_COLUMN ? (y - slice_start) * 
bpc : x * bpc;
                 const int yoff = mode == MATRIX_COLUMN ? x * dstride : 0;
 

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

Reply via email to