From 97b5240beeb9206f4dbda6ffce33b51aa16eec2f Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 18 Nov 2008 10:01:49 +0100 Subject: [PATCH] [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 Signed-off-by: Chris Wilson (cherry picked from commit 834f1d7b7097dcc3a32f6c65d21e87fd272d924a) --- AUTHORS | 1 + src/cairo-xcb-surface.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 488f4c0b7..289fecbae 100644 --- a/AUTHORS +++ b/AUTHORS @@ -16,6 +16,7 @@ Steve Chaplin Bug fixes for PNG reading Tomasz Cholewo Bug fixes Manu Cornet SVG build fix Frederic Crozat Fix test suite for OPD platforms (IA64 or PPC64) +Julien Danjou XCB fixes Radek DoulĂ­k Bug report and test case John Ehresman Build fixes for win32 John Ellson First font/glyph extents functions diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index 9b7eb4b7f..c63e851e4 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;