diff options
author | Julien Danjou <julien@danjou.info> | 2008-11-18 10:01:49 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-12-14 11:01:41 +0000 |
commit | 97b5240beeb9206f4dbda6ffce33b51aa16eec2f (patch) | |
tree | dbfc2f8f0f47059293acab3cfa420762925fe0ff /src | |
parent | 6fed98c0d3b0708ad5171654179a482fa7d88805 (diff) |
[xcb] check for render extension presence
Otherwise this may leads to an invalid memory access to r.
Fixes: Bug 18588 - XCB backend fails with missing render.
https://bugs.freedesktop.org/show_bug.cgi?id=18588
Signed-off-by: Julien Danjou <julien@danjou.info>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit 834f1d7b7097dcc3a32f6c65d21e87fd272d924a)
Diffstat (limited to 'src')
-rw-r--r-- | src/cairo-xcb-surface.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index 9b7eb4b7..c63e851e 100644 --- a/src/cairo-xcb-surface.c +++ b/src/cairo-xcb-surface.c @@ -1732,7 +1732,8 @@ _cairo_xcb_surface_create_internal (xcb_connection_t *dpy, int depth) { cairo_xcb_surface_t *surface; - const xcb_render_query_version_reply_t *r; + const xcb_query_extension_reply_t *er; + const xcb_render_query_version_reply_t *r = NULL; surface = malloc (sizeof (cairo_xcb_surface_t)); if (surface == NULL) @@ -1764,7 +1765,10 @@ _cairo_xcb_surface_create_internal (xcb_connection_t *dpy, ; } - r = xcb_render_util_query_version(dpy); + er = xcb_get_extension_data(dpy, &xcb_render_id); + if(er && er->present) { + r = xcb_render_util_query_version(dpy); + } if (r) { surface->render_major = r->major_version; surface->render_minor = r->minor_version; |