From fa04219cee42284deed528e243fb94014603a7ba Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 18 Nov 2008 10:01:49 +0100 Subject: [PATCH] xcb-surface: check for render extension presence Otherwise this may leads to an invalid memory access to r. Signed-off-by: Julien Danjou --- 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 63618bb..82f2e6e 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; -- 1.6.0.1