]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_neighbor: check if width is 1
authorPaul B Mahol <onemda@gmail.com>
Fri, 11 Oct 2019 09:18:10 +0000 (11:18 +0200)
committerPaul B Mahol <onemda@gmail.com>
Fri, 11 Oct 2019 09:19:00 +0000 (11:19 +0200)
Fixes #8242

libavfilter/vf_neighbor.c

index e50d4b4ed06d1082b98f189a774f7ea61c9c9fa0..47c6175a12743b0cfaee6ab5c45d3c15fa53fb08 100644 (file)
@@ -296,9 +296,11 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
                                                src + (width - 2) * bpc,                                                      src + (width - 2) * bpc,
                                                src + (width - 2) * bpc + ph * stride, src + (width - 1) * bpc + ph * stride, src + (width - 2) * bpc + ph * stride};
 
-            s->filter(dst,                     src,                     1,         threshold, coordinateslb, s->coordinates, s->max);
-            s->filter(dst          + 1  * bpc, src          + 1  * bpc, width - 2, threshold, coordinates,   s->coordinates, s->max);
-            s->filter(dst + (width - 1) * bpc, src + (width - 1) * bpc, 1,         threshold, coordinatesrb, s->coordinates, s->max);
+            s->filter(dst,                         src,                     1,         threshold, coordinateslb, s->coordinates, s->max);
+            if (width > 1) {
+                s->filter(dst          + 1  * bpc, src          + 1  * bpc, width - 2, threshold, coordinates,   s->coordinates, s->max);
+                s->filter(dst + (width - 1) * bpc, src + (width - 1) * bpc, 1,         threshold, coordinatesrb, s->coordinates, s->max);
+            }
 
             src += stride;
             dst += dstride;