[FFmpeg-devel] [PATCH] delogo will fail if interp is zero.

wuxiaoyong bonderwu at gmail.com
Wed Jan 31 05:25:00 EET 2018


With ROUNDED_DIV operation, if the first parameter is 0, it will
overflow and return a very large number, delogo will fail.
So, if it's zero, just set it to 1, it will not affect the result so
much.

Signed-off-by: wuxiaoyong <bonderwu at gmail.com>
---
 libavfilter/vf_delogo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index 065d093..73ad6b9 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -126,7 +126,7 @@ static void apply_delogo(uint8_t *dst, int dst_linesize,
                  botleft[x-logo_x1-1]  +
                  botleft[x-logo_x1+1]) * weightb;
             weight = (weightl + weightr + weightt + weightb) * 3U;
-            interp = ROUNDED_DIV(interp, weight);
+            interp = ROUNDED_DIV(interp <= 0 ? 1 : interp, weight);
 
             if (y >= logo_y+band && y < logo_y+logo_h-band &&
                 x >= logo_x+band && x < logo_x+logo_w-band) {
-- 
2.7.4



More information about the ffmpeg-devel mailing list