[Spice-devel] [PATCH 02/18] Prevent setting invalid image compression values

Frediano Ziglio fziglio at redhat.com
Mon Sep 26 08:12:35 UTC 2016


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/red-worker.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/server/red-worker.c b/server/red-worker.c
index e55a939..7c7eafe 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -956,9 +956,9 @@ static void handle_dev_set_compression(void *opaque, void *payload)
 {
     RedWorkerMessageSetCompression *msg = payload;
     RedWorker *worker = opaque;
+    SpiceImageCompression image_compression = msg->image_compression;
 
-    worker->image_compression = msg->image_compression;
-    switch (worker->image_compression) {
+    switch (image_compression) {
     case SPICE_IMAGE_COMPRESSION_AUTO_LZ:
         spice_info("ic auto_lz");
         break;
@@ -984,7 +984,9 @@ static void handle_dev_set_compression(void *opaque, void *payload)
         break;
     default:
         spice_warning("ic invalid");
+        image_compression = worker->image_compression;
     }
+    worker->image_compression = image_compression;
 
     display_channel_compress_stats_print(worker->display_channel);
     display_channel_compress_stats_reset(worker->display_channel);
-- 
2.7.4



More information about the Spice-devel mailing list