diff options
author | Mike Blumenkrantz <michael.blumenkrantz@gmail.com> | 2023-07-10 14:31:18 -0400 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2023-07-28 18:48:24 +0100 |
commit | 2cb7181890ce7573a7abd3f7ef8278784ac5d6e0 (patch) | |
tree | 4d0b55babfeb6ed97e8aa19766e4b7faaf32ae2f /src/glx | |
parent | f77250791c736126a64eac31d8ad6578f5680192 (diff) | |
download | mesa-2cb7181890ce7573a7abd3f7ef8278784ac5d6e0.tar.gz mesa-2cb7181890ce7573a7abd3f7ef8278784ac5d6e0.tar.bz2 mesa-2cb7181890ce7573a7abd3f7ef8278784ac5d6e0.zip |
glxsw: check geometry of drawables on creation
this mimics the dri codepath and allows early rejection of invalid
drawables to avoid subsequent breakage
cc: mesa-stable
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24075>
(cherry picked from commit 7100ef4566595f73b967231d0b877781d0911de5)
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/drisw_glx.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 9b67a1a871f..7dd41eb8746 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -675,11 +675,22 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable, { struct drisw_drawable *pdp; __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes; + unsigned depth; struct drisw_screen *psc = (struct drisw_screen *) base; const __DRIswrastExtension *swrast = psc->swrast; const __DRIkopperExtension *kopper = psc->kopper; Display *dpy = psc->base.dpy; + xcb_connection_t *conn = XGetXCBConnection(dpy); + xcb_generic_error_t *error; + xcb_get_geometry_cookie_t cookie = xcb_get_geometry(conn, xDrawable); + xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(conn, cookie, &error); + if (reply) + depth = reply->depth; + free(reply); + if (!reply || error) + return NULL; + pdp = calloc(1, sizeof(*pdp)); if (!pdp) return NULL; @@ -709,11 +720,6 @@ driswCreateDrawable(struct glx_screen *base, XID xDrawable, /* Otherwise, or if XGetVisualInfo failed, ask the server */ if (pdp->xDepth == 0) { - Window root; - int x, y; - unsigned uw, uh, bw, depth; - - XGetGeometry(dpy, xDrawable, &root, &x, &y, &uw, &uh, &bw, &depth); pdp->xDepth = depth; } |