[gtk-vnc] Avoid sign extension warnings from coverity



commit c3e5d23d67c9a209f127caab7843d94a91031a5f
Author: Daniel P. Berrange <berrange redhat com>
Date:   Thu Apr 6 17:21:29 2017 +0100

    Avoid sign extension warnings from coverity
    
     src/vncconnection.c:3082: sign_extension:
     Suspicious implicit sign extension: "height" with type "unsigned short"
     (16 bits, unsigned) is promoted in "rowlen * height" to type "int"
     (32 bits, signed), then sign-extended to type "unsigned long"
     (64 bits, unsigned). If "rowlen * height" is greater than 0x7FFFFFFF,
     the upper bits of the result will all be 1.
    
    The 'rowlen' variable is initialization from the unsigned width
    variable, so should have used uint instead of int.
    
    Signed-off-by: Daniel P. Berrange <berrange redhat com>

 src/vncconnection.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/vncconnection.c b/src/vncconnection.c
index 19dbfee..c55f71d 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -3064,7 +3064,7 @@ static void vnc_connection_xcursor(VncConnection *conn, guint16 x, guint16 y, gu
         guint8 *pixbuf = NULL;
         guint8 *data, *mask, *datap, *maskp;
         guint32 *pixp;
-        int rowlen;
+        guint rowlen;
         int x1, y1;
         guint8 fgrgb[3], bgrgb[3];
         guint32 fg, bg;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]