From ba2e82d138eecb451c3d0bf53d9c349fb560f039 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 31 Mar 2008 10:55:39 +0100 Subject: [PATCH] [cairo-ps-surface] Check error status before potential illegal dereference. After acquiring the source image, check for the error status to ensure that we do not attempt to deference an invalid surface. --- src/cairo-ps-surface.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 1ae2158c8..a197ff969 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -2142,17 +2142,23 @@ _cairo_ps_surface_acquire_surface (cairo_ps_surface_t *surface, cairo_rectangle_int_t pattern_extents; status = _cairo_surface_get_extents (meta_surface, &pattern_extents); + if (status) + return status; + *width = pattern_extents.width; *height = pattern_extents.height; } else { status = _cairo_surface_acquire_source_image (pattern->surface, &surface->image, &surface->image_extra); + if (status) + return status; + *width = surface->image->width; *height = surface->image->height; } - return status; + return CAIRO_STATUS_SUCCESS; } static cairo_status_t