From 67751f60962cd1d725a2b88a6fe2f5c0157ec355 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 6 May 2025 16:47:01 +0200 Subject: [PATCH] render: NULL protect cpAlphaMap() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even though it practically should never happen, but just in case, and for silencing the analyzer, add an extra check here (which doesn't cost us much). | ../render/picture.c: In function ‘cpAlphaMap’: | ../render/picture.c:1002:30: warning: dereference of NULL ‘screen’ [CWE-476] [-Wanalyzer-null-dereference] | 1002 | id = res->info[screen->myNum].id; | | ~~~~~~^~~~~~~ Signed-off-by: Enrico Weigelt, metux IT consult --- render/picture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/render/picture.c b/render/picture.c index feb29a7d7..062865354 100644 --- a/render/picture.c +++ b/render/picture.c @@ -1013,7 +1013,10 @@ cpAlphaMap(void **result, XID id, ScreenPtr screen, ClientPtr client, Mask mode) client, mode); if (err != Success) return err; - id = res->info[screen->myNum].id; + if (screen == NULL) + LogMessage(X_WARNING, "cpAlphaMap() screen == NULL\n"); + else + id = res->info[screen->myNum].id; } #endif /* XINERAMA */ return dixLookupResourceByType(result, id, PictureType, client, mode);