1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-06-14 22:15:12 +02:00

avfilter/vf_edgedetect: fix heap-buffer overflow

Fixes #8275

(cherry picked from commit de598f82f8)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Paul B Mahol
2019-10-15 16:38:40 +02:00
committed by Michael Niedermayer
parent da58e7fb9e
commit 222783e2fa

View File

@ -126,6 +126,7 @@ static void gaussian_blur(AVFilterContext *ctx, int w, int h,
memcpy(dst, src, w); dst += dst_linesize; src += src_linesize; memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
for (j = 2; j < h - 2; j++) { for (j = 2; j < h - 2; j++) {
dst[0] = src[0]; dst[0] = src[0];
if (w > 1)
dst[1] = src[1]; dst[1] = src[1];
for (i = 2; i < w - 2; i++) { for (i = 2; i < w - 2; i++) {
/* Gaussian mask of size 5x5 with sigma = 1.4 */ /* Gaussian mask of size 5x5 with sigma = 1.4 */
@ -147,7 +148,9 @@ static void gaussian_blur(AVFilterContext *ctx, int w, int h,
+ src[i+1] * 12 + src[i+1] * 12
+ src[i+2] * 5) / 159; + src[i+2] * 5) / 159;
} }
if (w > 2)
dst[i ] = src[i ]; dst[i ] = src[i ];
if (w > 3)
dst[i + 1] = src[i + 1]; dst[i + 1] = src[i + 1];
dst += dst_linesize; dst += dst_linesize;