diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-01-17 21:11:00 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-01-17 21:11:00 +0000 |
commit | b15e91d2b6c229dfe3da4a354306915cc42f75bd (patch) | |
tree | c5d7cc8097362fc8220ca2cabe18a400fa78d438 /src/cairo-font-options.c | |
parent | 630536f17681b083db658414d68db2c0eb167af3 (diff) | |
download | cairo-b15e91d2b6c229dfe3da4a354306915cc42f75bd.tar.gz |
[cairo-font-options] Check for a NULL cairo_font_options_t
On IRC Drakou reported a user error whereby cairo_scaled_font_create()
was called with a NULL cairo_font_options_t. However, instead of
reporting the error back to the user, cairo instead segfaulted trying
to dereference the NULL pointer!
Add a guard to check that the options is not NULL.
Diffstat (limited to 'src/cairo-font-options.c')
-rw-r--r-- | src/cairo-font-options.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cairo-font-options.c b/src/cairo-font-options.c index c5d5c12b5..6b2cb08e2 100644 --- a/src/cairo-font-options.c +++ b/src/cairo-font-options.c @@ -161,7 +161,9 @@ slim_hidden_def (cairo_font_options_destroy); cairo_status_t cairo_font_options_status (cairo_font_options_t *options) { - if (options == (cairo_font_options_t *)&_cairo_font_options_nil) + if (options == NULL) + return CAIRO_STATUS_NULL_POINTER; + else if (options == (cairo_font_options_t *)&_cairo_font_options_nil) return CAIRO_STATUS_NO_MEMORY; else return CAIRO_STATUS_SUCCESS; |