[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.
This commit is contained in:
Chris Wilson 2008-08-12 21:21:20 +01:00
parent 922df7fc23
commit c73b3e43e1

View file

@ -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);