Mesa (master): glx: Be more robust against null fbconfigs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 13 23:31:32 UTC 2021


Module: Mesa
Branch: master
Commit: b8236bcb7444157c0acbf9b775856be7075e97e1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8236bcb7444157c0acbf9b775856be7075e97e1

Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Apr 12 11:33:17 2021 -0400

glx: Be more robust against null fbconfigs

These can happen along the internal paths for no-config contexts, and we
shouldn't crash.

Acked-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9992>

---

 src/glx/glx_pbuffer.c | 3 +++
 src/glx/glxcmds.c     | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index 73835b5cced..74b9b55c718 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -455,6 +455,9 @@ CreateDrawable(Display *dpy, struct glx_config *config,
    CARD8 opcode;
    GLXDrawable xid;
 
+   if (!config)
+      return None;
+
    i = 0;
    if (attrib_list) {
       while (attrib_list[i * 2] != None)
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index fb4249ebab2..7a2a31ad26b 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -1732,6 +1732,9 @@ glXGetVisualFromFBConfig(Display * dpy, GLXFBConfig fbconfig)
    struct glx_config *config = (struct glx_config *) fbconfig;
    int count;
 
+   if (!config)
+      return NULL;
+
    /*
     ** Get a list of all visuals, return if list is empty
     */



More information about the mesa-commit mailing list