[Spice-commits] 4 commits - server/dcc.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Thu Sep 15 14:17:28 UTC 2016


 server/dcc.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 4cb02250f48686ef9e32b214b79d2f381eb1a7b2
Author: Uri Lublin <uril at redhat.com>
Date:   Wed Sep 14 15:31:02 2016 +0300

    dcc_compress_image: fix a possible overflow when calculating image_size
    
    Both src->stride and src->y are uint32_t
    Fixed by making one of them uint64_t
    
    Found by coverity
    
    Signed-off-by: Uri Lublin <uril at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/dcc.c b/server/dcc.c
index 2587d72..a56b658 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -767,7 +767,7 @@ lz_compress:
     }
 
     if (!success) {
-        uint64_t image_size = src->stride * src->y;
+        uint64_t image_size = src->stride * (uint64_t)src->y;
         stat_compress_add(&display_channel->encoder_shared_data.off_stat, start_time, image_size, image_size);
     }
 
commit 37e4cae9d4c690245d9256932a15583c98a2886c
Author: Uri Lublin <uril at redhat.com>
Date:   Wed Sep 14 15:31:01 2016 +0300

    dcc_gl_draw_item_new: allocate item when needed
    
    Prevents a leak on early return.
    
    Found by coverity.
    
    Signed-off-by: Uri Lublin <uril at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/dcc.c b/server/dcc.c
index cdd888b..2587d72 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -591,7 +591,7 @@ RedPipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num)
 {
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
     const SpiceMsgDisplayGlDraw *draw = data;
-    RedGlDrawItem *item = spice_new(RedGlDrawItem, 1);
+    RedGlDrawItem *item;
 
     if (!red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_GL_SCANOUT)) {
         spice_printerr("FIXME: client does not support GL scanout");
@@ -600,6 +600,7 @@ RedPipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num)
     }
 
     dcc->priv->gl_draw_ongoing = TRUE;
+    item = spice_new(RedGlDrawItem, 1);
     item->draw = *draw;
     red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_GL_DRAW);
 
commit dc6c57668aa05bcec3c43422da9011d4cfc40811
Author: Uri Lublin <uril at redhat.com>
Date:   Wed Sep 14 15:31:00 2016 +0300

    dcc_gl_scanout_item_new: allocate item when needed
    
    Prevents a leak on early return.
    
    Found by coverity.
    
    Signed-off-by: Uri Lublin <uril at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/dcc.c b/server/dcc.c
index 1a7aac9..cdd888b 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -571,7 +571,7 @@ static RedSurfaceDestroyItem *red_surface_destroy_item_new(RedChannel *channel,
 
 RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
 {
-    RedGlScanoutUnixItem *item = spice_new(RedGlScanoutUnixItem, 1);
+    RedGlScanoutUnixItem *item;
 
     /* FIXME: on !unix peer, start streaming with a video codec */
     if (!reds_stream_is_plain_unix(red_channel_client_get_stream(rcc)) ||
@@ -581,6 +581,7 @@ RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
         return NULL;
     }
 
+    item = spice_new(RedGlScanoutUnixItem, 1);
     red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_GL_SCANOUT);
 
     return &item->base;
commit 42066f03ec7b76223a57cd25e520191f3494e5da
Author: Uri Lublin <uril at redhat.com>
Date:   Wed Sep 14 15:30:59 2016 +0300

    dcc: do not check the pointer returned by spice_new
    
    The rest of the code assumes spice_new does not return NULL
    
    Signed-off-by: Uri Lublin <uril at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/dcc.c b/server/dcc.c
index 36c9c1d..1a7aac9 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -572,7 +572,6 @@ static RedSurfaceDestroyItem *red_surface_destroy_item_new(RedChannel *channel,
 RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
 {
     RedGlScanoutUnixItem *item = spice_new(RedGlScanoutUnixItem, 1);
-    spice_return_val_if_fail(item != NULL, NULL);
 
     /* FIXME: on !unix peer, start streaming with a video codec */
     if (!reds_stream_is_plain_unix(red_channel_client_get_stream(rcc)) ||
@@ -592,7 +591,6 @@ RedPipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num)
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
     const SpiceMsgDisplayGlDraw *draw = data;
     RedGlDrawItem *item = spice_new(RedGlDrawItem, 1);
-    spice_return_val_if_fail(item != NULL, NULL);
 
     if (!red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_GL_SCANOUT)) {
         spice_printerr("FIXME: client does not support GL scanout");


More information about the Spice-commits mailing list