diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-09-08 15:12:58 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-09-08 15:12:58 +0100 |
commit | 558f0a5ab4a88937b8c212c13309d11cb1a101af (patch) | |
tree | 4e4fa76dd4647c03da2ff3803be605b4677f6f20 /src/cairo-image-surface-inline.h | |
parent | b0c466e27afcec230b2c9436eeb924c05123a544 (diff) | |
download | cairo-558f0a5ab4a88937b8c212c13309d11cb1a101af.tar.gz |
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@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-image-surface-inline.h')
-rw-r--r-- | src/cairo-image-surface-inline.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cairo-image-surface-inline.h b/src/cairo-image-surface-inline.h index 49591073f..743d5fd3e 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; } /** |