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

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