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

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