ffmpeg | branch: master | Thilo Borgmann <thilo.borgm...@mail.de> | Wed Apr 27 
11:37:12 2022 +0200| [79286d3eb64b5ce56e30d88f2d34692adb3fcaf0] | committer: 
Thilo Borgmann

avfilter/vf_blurdetect: fix uninitialized variables and possible div by zero

Found-by: Coverity

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

 libavfilter/vf_blurdetect.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_blurdetect.c b/libavfilter/vf_blurdetect.c
index e29ed5041d..0e08ba96de 100644
--- a/libavfilter/vf_blurdetect.c
+++ b/libavfilter/vf_blurdetect.c
@@ -138,6 +138,7 @@ static float edge_width(BLRContext *blr, int i, int j, 
int8_t dir, int w, int h,
     case DIRECTION_VERTICAL:   dX = 0; dY =  1; break;
     case DIRECTION_45UP:       dX = 1; dY = -1; break;
     case DIRECTION_45DOWN:     dX = 1; dY =  1; break;
+    default:                   dX = 1; dY =  1; break;
     }
 
     // determines if search in direction dX/dY is looking for a maximum or 
minimum
@@ -227,7 +228,7 @@ static float calculate_blur(BLRContext *s, int w, int h, 
int hsub, int vsub,
                 }
             }
             // if not enough edge pixels in a block, consider it smooth
-            if (block_total_width >= 2) {
+            if (block_total_width >= 2 && block_count) {
                 blks[blkcnt] = block_total_width / block_count;
                 blkcnt++;
             }

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to