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

Chris Wilson ickle at kemper.freedesktop.org
Tue Aug 12 13:31:21 PDT 2008


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

New commits:
commit c73b3e43e120065e40d8fc48c9bdbd88ebe8ab40
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Aug 12 21:21:20 2008 +0100

    [cairo-surface] Check for the error surface in _get_font_options()
    
    cairo_surface_get_font_options() has the side effect of initialising the
    font options on the surface, but fails to check that the surface is
    valid first. Therefore if we are passed a read-only error object, we will
    trigger a segmentation fault.
    
    Most likely this is the bug behind:
    http://bugs.freedesktop.org/show_bug.cgi?id=17096.

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 3eca6fc..45c5c56 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -648,7 +648,12 @@ cairo_surface_get_font_options (cairo_surface_t       *surface,
     if (cairo_font_options_status (options))
 	return;
 
-    if (!surface->has_font_options) {
+    if (surface->status) {
+	_cairo_font_options_init_default (options);
+	return;
+    }
+
+    if (! surface->has_font_options) {
 	surface->has_font_options = TRUE;
 
 	_cairo_font_options_init_default (&surface->font_options);


More information about the cairo-commit mailing list