avfilter/vf_avgblur: fix heap-buffer overflow
authorPaul B Mahol <onemda@gmail.com>
Tue, 15 Oct 2019 14:31:15 +0000 (16:31 +0200)
committerPaul B Mahol <onemda@gmail.com>
Tue, 15 Oct 2019 14:31:15 +0000 (16:31 +0200)
Fixes #8274

libavfilter/vf_avgblur.c

index 40b4879..78a6806 100644 (file)
@@ -148,7 +148,7 @@ static int filter_vertically_##name(AVFilterContext *ctx, void *arg, int jobnr,
                                                                                               \
         src = s->buffer + x;                                                                  \
         ptr = buffer + x;                                                                     \
-        for (i = 0; i <= radius; i++) {                                                       \
+        for (i = 0; i + radius < height && i <= radius; i++) {                                \
             acc += src[(i + radius) * width];                                                 \
             count++;                                                                          \
             ptr[i * linesize] = acc / count;                                                  \