[Spice-commits] 2 commits - server/red_bitmap_utils.h server/red_worker.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Wed Aug 26 07:25:42 PDT 2015


 server/red_bitmap_utils.h |    3 ---
 server/red_worker.c       |    2 +-
 2 files changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 068bf4e83d2a615c26cdfc6ba7120590eacfed51
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Fri Aug 21 10:21:46 2015 +0100

    prevent integer overflow on 32 bit
    
    On 32 bit machine timespec->tv_sec (time_t) is 32 bit.
    Also 1000 * 1000 * 1000 is 32 bit.
    The multiplication of 2 32 bit integers gives a 32 bit integer, however
    this can overflow.
    Converting the first factor to 64 bit before the multiplication solves
    the issue.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/red_worker.c b/server/red_worker.c
index 9c6921b..eeffdd0 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -164,7 +164,7 @@ static void rendering_incorrect(const char *msg)
 
 static inline red_time_t timespec_to_red_time(struct timespec *time)
 {
-    return time->tv_sec * (1000 * 1000 * 1000) + time->tv_nsec;
+    return (red_time_t) time->tv_sec * (1000 * 1000 * 1000) + time->tv_nsec;
 }
 
 static clockid_t clock_id;
commit 6001d8905e1f7af36b06c5ee10e187a832fb3c90
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Fri Aug 21 10:31:13 2015 +0100

    remove unused SAME_PIXEL macro
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/red_bitmap_utils.h b/server/red_bitmap_utils.h
index 6d508a7..1c13ced 100644
--- a/server/red_bitmap_utils.h
+++ b/server/red_bitmap_utils.h
@@ -52,8 +52,6 @@
 
 
 #define SAMPLE_JUMP 15
-#define SAME_PIXEL(p1, p2) (GET_r(p1) == GET_r(p2) && GET_g(p1) == GET_g(p2) && \
-                            GET_b(p1) == GET_b(p2))
 
 static const double FNAME(PIX_PAIR_SCORE)[] = {
     SAME_PIXEL_WEIGHT,
@@ -148,7 +146,6 @@ static void FNAME(compute_lines_gradual_score)(PIXEL *lines, int width, int num_
 
 #undef PIXEL
 #undef FNAME
-#undef SAME_PIXEL
 #undef GET_r
 #undef GET_g
 #undef GET_b


More information about the Spice-commits mailing list