[cairo] crash in cairo_clip_intersect_rectangle_box

Ethan Nicholas ethan at ethannicholas.com
Wed Jul 16 20:25:12 PDT 2014


I just started using Cairo as a rendering backend and almost immediately ran into a crash. I simplified the failing case down to:

#include <cairo.h>

int main() {
    cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 800, 600);
    cairo_t *cr = cairo_create(surface);

    cairo_move_to(cr, 200, 300);
    cairo_curve_to(cr, 200.000000, 189.543050, 289.543050, 100.000000, 400.000000, 100.000000);
    cairo_curve_to(cr, 510.456950, 100.000000, 600.000000, 189.543050, 600.000000, 300.000000);
    cairo_curve_to(cr, 600.000000, 410.456950, 510.456950, 500.000000, 400.000000, 500.000000);
    cairo_curve_to(cr, 289.543050, 500.000000, 200.000000, 410.456950, 200.000000, 300.000000);
    cairo_clip(cr);

    cairo_move_to(cr, 352.287126, 66.212743);
    cairo_line_to(cr, 364.004851, 68.800196);
    cairo_line_to(cr, 359.045565, 91.259170);
    cairo_line_to(cr, 347.327840, 88.671716);
    cairo_line_to(cr, 352.287126, 66.212743);
    cairo_stroke(cr);

    cairo_destroy(cr);
    cairo_surface_destroy(surface);
    return 0;
}

This consistently crashes in cairo_clip_intersect_rectangle_box (MacOS X 10.9.3, Cairo 1.12.16 installed via MacPorts). I’m new to Cairo so it’s quite possible I’m doing something wrong; any help would be appreciated.

Thanks,

Ethan Nicholas
ethan at ethannicholas.com


More information about the cairo mailing list