diff --git a/src/cairo.c b/src/cairo.c index 4e3bfda40..4a1c73b71 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -3415,6 +3415,9 @@ cairo_append_path (cairo_t *cr, return; } + if (path->num_data == 0) + return; + if (path->data == NULL) { _cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER); return; diff --git a/test/copy-path.c b/test/copy-path.c index 256f46123..362bb34d3 100644 --- a/test/copy-path.c +++ b/test/copy-path.c @@ -141,7 +141,13 @@ draw (cairo_t *cr, int width, int height) cairo_path_destroy (path); return CAIRO_TEST_FAILURE; } + cairo_append_path (cr, path); cairo_path_destroy (path); + if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) { + cairo_test_log ("Error: cairo_append_path failed with a copy of an empty path, returned status of %s\n", + cairo_status_to_string (cairo_status (cr))); + return CAIRO_TEST_FAILURE; + } /* We draw in the default black, so paint white first. */ cairo_save (cr); @@ -224,6 +230,15 @@ main (void) path.num_data = 0; path.status = CAIRO_STATUS_SUCCESS; cairo_append_path (cr, &path); + if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) + return 1; + cairo_destroy (cr); + + cr = cairo_create (surface); + path.data = NULL; + path.num_data = 1; + path.status = CAIRO_STATUS_SUCCESS; + cairo_append_path (cr, &path); if (cairo_status (cr) != CAIRO_STATUS_NULL_POINTER) return 1; cairo_destroy (cr);