[FFmpeg-cvslog] avfilter/vf_edgedetect: check if height is big enough

Paul B Mahol git at videolan.org
Tue Sep 14 00:16:35 EEST 2021


ffmpeg | branch: release/4.1 | Paul B Mahol <onemda at gmail.com> | Sun Oct 13 17:23:10 2019 +0200| [540047eda8391da511142d782c4145b23fdad173] | committer: James Almer

avfilter/vf_edgedetect: check if height is big enough

Fixes #8260

(cherry picked from commit ccf4ab8c9aca0aee66bcc2914031a9c97ac0eeb8)
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=540047eda8391da511142d782c4145b23fdad173
---

 libavfilter/vf_edgedetect.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_edgedetect.c b/libavfilter/vf_edgedetect.c
index a0ddcbbf5c..11a31fa4ff 100644
--- a/libavfilter/vf_edgedetect.c
+++ b/libavfilter/vf_edgedetect.c
@@ -150,7 +150,8 @@ static void gaussian_blur(AVFilterContext *ctx, int w, int h,
     int i, j;
 
     memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
-    memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
+    if (h > 1)
+        memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
     for (j = 2; j < h - 2; j++) {
         dst[0] = src[0];
         dst[1] = src[1];
@@ -180,8 +181,10 @@ static void gaussian_blur(AVFilterContext *ctx, int w, int h,
         dst += dst_linesize;
         src += src_linesize;
     }
-    memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
-    memcpy(dst, src, w);
+    if (h > 2)
+        memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
+    if (h > 3)
+        memcpy(dst, src, w);
 }
 
 enum {



More information about the ffmpeg-cvslog mailing list