Created attachment 93749 Code to reproduce the crash When a sufficiently complex path, consisting of multiple subpaths, is used both for clip and for stroke, cairo sometimes crashes in a segmentation fault. The crash seems to happen in the function active_edges, where in the innermost do...while loop the "right" variable for some reason gets a NULL value: Program received signal SIGSEGV, Segmentation fault. active_edges (polygon=0x7fffffffd440, top=32768, left=0x6b9a80) at /build/buildd/cairo-1.12.16/src/cairo-polygon-intersect.c:1235 1235 /build/buildd/cairo-1.12.16/src/cairo-polygon-intersect.c: No such file or directory. (gdb) where #0 active_edges (polygon=0x7fffffffd440, top=32768, left=0x6b9a80) at /build/buildd/cairo-1.12.16/src/cairo-polygon-intersect.c:1235 #1 intersection_sweep (polygon=0x7fffffffd440, num_events=, start_events=) at /build/buildd/cairo-1.12.16/src/cairo-polygon-intersect.c:1271 #2 _cairo_polygon_intersect (a=a@entry=0x7fffffffd440, winding_a=winding_a@entry=0, b=b@entry=0x7fffffffcff0, winding_b=) at /build/buildd/cairo-1.12.16/src/cairo-polygon-intersect.c:1466 #3 0x00007ffff7b3812a in clip_and_composite_polygon (compositor=compositor@entry=0x7ffff7dd8000 , extents=extents@entry=0x7fffffffd880, polygon=polygon@entry=0x7fffffffd440, fill_rule=CAIRO_FILL_RULE_WINDING, antialias=antialias@entry=CAIRO_ANTIALIAS_DEFAULT) at /build/buildd/cairo-1.12.16/src/cairo-spans-compositor.c:937 #4 0x00007ffff7b38c77 in _cairo_spans_compositor_stroke (_compositor=0x7ffff7dd8000 , extents=0x7fffffffd880, path=, style=0x7fffffffdc70, ctm=0x604c70, ctm_inverse=0x604ca0, tolerance=0,10000000000000001, antialias=CAIRO_ANTIALIAS_DEFAULT) at /build/buildd/cairo-1.12.16/src/cairo-spans-compositor.c:1074 #5 0x00007ffff7af7974 in _cairo_compositor_stroke (compositor=0x7ffff7dd8000 , surface=0x6049c0, op=CAIRO_OPERATOR_OVER, source=0x7fffffffdca0, path=0x604eb8, style=0x7fffffffdc70, ctm=0x604c70, ctm_inverse=ctm_inverse@entry=0x604ca0, tolerance=0,10000000000000001, antialias=antialias@entry=CAIRO_ANTIALIAS_DEFAULT, clip=clip@entry=0x6089f0) at /build/buildd/cairo-1.12.16/src/cairo-compositor.c:157 #6 0x00007ffff7b07953 in _cairo_image_surface_stroke (abstract_surface=, op=, source=, path=, style=, ctm=, ctm_inverse=0x604ca0, tolerance=, antialias=CAIRO_ANTIALIAS_DEFAULT, clip=0x6089f0) at /build/buildd/cairo-1.12.16/src/cairo-image-surface.c:961 #7 0x00007ffff7b3bd42 in _cairo_surface_stroke (surface=0x6049c0, op=CAIRO_OPERATOR_OVER, source=0x7fffffffdca0, path=0x604eb8, stroke_style=0x7fffffffdc70, ctm=0x604c70, ctm_inverse=0x604ca0, tolerance=0,10000000000000001, antialias=CAIRO_ANTIALIAS_DEFAULT, clip=0x6089f0) at /build/buildd/cairo-1.12.16/src/cairo-surface.c:2210 #8 0x00007ffff7aff05f in _cairo_gstate_stroke (gstate=0x604b80, path=path@entry=0x604eb8) at /build/buildd/cairo-1.12.16/src/cairo-gstate.c:1185 #9 0x00007ffff7af9079 in _cairo_default_context_stroke (abstract_cr=0x604b50) at /build/buildd/cairo-1.12.16/src/cairo-default-context.c:1013 #10 0x00007ffff7af2875 in INT_cairo_stroke (cr=0x604b50) at /build/buildd/cairo-1.12.16/src/cairo.c:2146 #11 0x0000000000400b8f in main () at bug.c:28 Can be reproduced reliably with the attached code.