[cairo-commit] src/cairo-image-surface-inline.h
Chris Wilson
ickle at kemper.freedesktop.org
Sat Sep 8 07:15:18 PDT 2012
src/cairo-image-surface-inline.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 558f0a5ab4a88937b8c212c13309d11cb1a101af
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sat Sep 8 15:12:58 2012 +0100
image: Check for an error surface before dereferencing the backend
As the surface->backend will be NULL in such an error surface, and we
may be legitimately doing boundary checks to reject the error surface.
The alternative would be to set an explicit error surface backend.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54664
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-image-surface-inline.h b/src/cairo-image-surface-inline.h
index 4959107..743d5fd 100644
--- a/src/cairo-image-surface-inline.h
+++ b/src/cairo-image-surface-inline.h
@@ -73,7 +73,8 @@ _cairo_image_surface_is_clone (cairo_image_surface_t *image)
static inline cairo_bool_t
_cairo_surface_is_image (const cairo_surface_t *surface)
{
- return surface->backend->type == CAIRO_SURFACE_TYPE_IMAGE;
+ /* _cairo_surface_nil sets a NULL backend so be safe */
+ return surface->backend && surface->backend->type == CAIRO_SURFACE_TYPE_IMAGE;
}
/**
More information about the cairo-commit
mailing list