mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 03:18:05 +02:00
[output-stream] Protect against NULL write_func.
Allow the user to specify a NULL write_func for the output stream so that a dummy surface can be created, for example, for querying target font options or font extents. Currently we do not perform any sanity checks at the user entry point and will generate a mysterious SEGV during cairo_surface_finish() - which may not immediately be obvious that it is due to a NULL write_func.
This commit is contained in:
parent
84e4a825ff
commit
41c8eefc6d
1 changed files with 3 additions and 0 deletions
|
|
@ -116,6 +116,9 @@ closure_write (cairo_output_stream_t *stream,
|
|||
cairo_output_stream_with_closure_t *stream_with_closure =
|
||||
(cairo_output_stream_with_closure_t *) stream;
|
||||
|
||||
if (stream_with_closure->write_func == NULL)
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
||||
return stream_with_closure->write_func (stream_with_closure->closure,
|
||||
data, length);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue