[cairo] Assertion `i < pen->num_vertices' failed in 1.4.10

Chris Wilson chris at chris-wilson.co.uk
Mon Aug 27 02:41:03 PDT 2007

Benjamin Otte (otte at gnome.org) said: 
> I just found a crasher in cairo 1.4.10 while trying to watch the
> presentation Miguel linked to on Planet Gnome [1] in Swfdec.
> So I grabbed libcairowrap and threw it at the problem. After throwing
> away everything that did not relate to the crash, I got a small enough
> result. It's attached.

For the record the failure message is:
cairo-pen.c:324: _cairo_pen_find_active_cw_vertex_index: Assertion `i < pen->num_vertices' failed.

The issue appears to be that the rectangle is projected onto a 1D line.
Unfortunately _cairo_slope_compare() has a big WARNING that it will not
work correctly on antiparallel lines.

My random hack of the day is:
diff --git a/src/cairo-slope.c b/src/cairo-slope.c
index 78664c5..00650b9 100644
--- a/src/cairo-slope.c
+++ b/src/cairo-slope.c
@@ -78,6 +78,9 @@ _cairo_slope_compare (cairo_slope_t *a, cairo_slope_t
     if (b->dx == 0 && b->dy ==0)
        return -1;
+    if (a->dy == 0 && b->dy == 0)
+       return a->dx * b->dx;
     return 0;

Chris Wilson

More information about the cairo mailing list