lavfi/delogo: Fix sign extension issue
authorJean Delvare <khali@linux-fr.org>
Sat, 13 Jul 2013 14:50:42 +0000 (16:50 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 13 Jul 2013 15:05:03 +0000 (17:05 +0200)
Coverity complains about a possible sign extension issue in
apply_delogo(). While it is extremely unlikely to happen, it is easy
to fix so let's just do that. Using unsigned variables even makes the
binary code smaller.

Fixes Coverity CID 1046439.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/vf_delogo.c

index 8356c615dcb9e466697a0e149c4d5324c6fcf565..45a29cf00c752ef93e65c2e49a2b76b7fdd11f4c 100644 (file)
@@ -58,9 +58,9 @@ static void apply_delogo(uint8_t *dst, int dst_linesize,
                          uint8_t *src, int src_linesize,
                          int w, int h, AVRational sar,
                          int logo_x, int logo_y, int logo_w, int logo_h,
-                         int band, int show, int direct)
+                         unsigned int band, int show, int direct)
 {
-    int x, y, dist;
+    int x, y;
     uint64_t interp, weightl, weightr, weightt, weightb;
     uint8_t *xdst, *xsrc;
 
@@ -125,7 +125,8 @@ static void apply_delogo(uint8_t *dst, int dst_linesize,
                 x >= logo_x+band && x < logo_x+logo_w-band) {
                 *xdst = interp;
             } else {
-                dist = 0;
+                unsigned dist = 0;
+
                 if      (x < logo_x+band)
                     dist = FFMAX(dist, logo_x-x+band);
                 else if (x >= logo_x+logo_w-band)