Blame SOURCES/0027-main-add-stricter-pre-condition-on-display-id-value.patch

542743
From e521ddee98961bb30a7a3d93c6c01dddb7da3662 Mon Sep 17 00:00:00 2001
542743
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
542743
Date: Tue, 15 Sep 2020 13:09:46 +0400
542743
Subject: [PATCH] main: add stricter pre-condition on display id value
542743
MIME-Version: 1.0
542743
Content-Type: text/plain; charset=UTF-8
542743
Content-Transfer-Encoding: 8bit
542743
542743
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
542743
Acked-by: Frediano Ziglio <fziglio@redhat.com>
542743
---
542743
 src/channel-main.c | 4 ++--
542743
 1 file changed, 2 insertions(+), 2 deletions(-)
542743
542743
diff --git a/src/channel-main.c b/src/channel-main.c
542743
index 671716a..5fcf8e8 100644
542743
--- a/src/channel-main.c
542743
+++ b/src/channel-main.c
542743
@@ -2723,7 +2723,7 @@ void spice_main_channel_update_display(SpiceMainChannel *channel, int id, int x,
542743
 
542743
     c = SPICE_MAIN_CHANNEL(channel)->priv;
542743
 
542743
-    g_return_if_fail(id < SPICE_N_ELEMENTS(c->display));
542743
+    g_return_if_fail(id >= 0 && id < SPICE_N_ELEMENTS(c->display));
542743
 
542743
     SpiceDisplayConfig display = {
542743
         .x = x, .y = y, .width = width, .height = height,
542743
@@ -3040,7 +3040,7 @@ void spice_main_channel_update_display_enabled(SpiceMainChannel *channel, int id
542743
             c->display[i].display_state = display_state;
542743
         }
542743
     } else {
542743
-        g_return_if_fail(id < G_N_ELEMENTS(c->display));
542743
+        g_return_if_fail(id >= 0 && id < G_N_ELEMENTS(c->display));
542743
         if (c->display[id].display_state == display_state)
542743
             return;
542743
         c->display[id].display_state = display_state;
542743
-- 
542743
2.28.0
542743