glx: NULL-protect validGlxFBConfigForWindow()

If this ever happens, we clearly have a bug, so print out proper warning,
instead of silently crashing the Xserver.

| ../glx/glxcmds.c: In function ‘validGlxFBConfigForWindow’:
| ../glx/glxcmds.c:127:16: warning: dereference of NULL ‘pVisual’ [CWE-476] [-Wanalyzer-null-dereference]
|   127 |     if (pVisual->class != glxConvertToXVisualType(config->visualType) ||
|       |         ~~~~~~~^~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-05-06 14:36:57 +02:00
parent 1e055b5ddc
commit 2274f23e60

View File

@ -36,6 +36,7 @@
#include <X11/extensions/presenttokens.h>
#include "dix/dix_priv.h"
#include "os/bug_priv.h"
#include "glxserver.h"
#include <unpack.h>
@ -122,6 +123,8 @@ validGlxFBConfigForWindow(ClientPtr client, __GLXconfig * config,
}
}
BUG_RETURN_VAL(!pVisual, FALSE);
/* FIXME: What exactly should we check here... */
if (pVisual->class != glxConvertToXVisualType(config->visualType) ||
!(config->drawableType & GLX_WINDOW_BIT)) {