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-12 10:20:47 +0000 |
commit | 834f1d7b7097dcc3a32f6c65d21e87fd272d924a (patch) | |
tree | 0be57b1913a9a8512d203c861104d2992261206b | |
parent | e184bf0d3592c8703b1193d37553cdcdee313139 (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>
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | src/cairo-xcb-surface.c | 8 |
2 files changed, 7 insertions, 2 deletions
@@ -16,6 +16,7 @@ Steve Chaplin <stevech1097@yahoo.com.au> Bug fixes for PNG reading Tomasz Cholewo <cholewo@ieee-cis.org> Bug fixes Manu Cornet <manu@manucornet.net> SVG build fix Frederic Crozat <fcrozat@mandriva.com> Fix test suite for OPD platforms (IA64 or PPC64) +Julien Danjou <julien@danjou.info> XCB fixes Radek DoulĂk <rodo@novell.com> Bug report and test case John Ehresman <jpe@wingide.com> Build fixes for win32 John Ellson <ellson@research.att.com> First font/glyph extents functions diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index 6f246f80..2ae7dcf3 100644 --- a/src/cairo-xcb-surface.c +++ b/src/cairo-xcb-surface.c @@ -1735,7 +1735,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) @@ -1767,7 +1768,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; |