[cairo-commit] src/cairo-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Oct 29 05:07:50 PDT 2007


 src/cairo-surface.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit 4a2ab87e1a19921e2ae496f375c1144d2710d0c4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Oct 29 12:04:33 2007 +0000

    [cairo-surface] Add the usual guards to _cairo_surface_set_font_options().
    
    Adrian Johnson hit a SEGV after
    _cairo_paginaged_surface_create_image_surface() tried to set the font
    options on an error surface after running out of memory. So add the
    usual checks that the surface is not a snapshot, or in an error state or
    finished before modifying its font options.

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index d0a5c46..4fa2e4c 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -590,6 +590,19 @@ void
 _cairo_surface_set_font_options (cairo_surface_t       *surface,
 				 cairo_font_options_t  *options)
 {
+    cairo_status_t status;
+
+    assert (! surface->is_snapshot);
+
+    if (surface->status)
+	return;
+
+    if (surface->finished) {
+	status = _cairo_surface_set_error (surface,
+		                           CAIRO_STATUS_SURFACE_FINISHED);
+	return;
+    }
+
     if (options) {
 	surface->has_font_options = TRUE;
 	_cairo_font_options_init_copy (&surface->font_options, options);


More information about the cairo-commit mailing list