diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-04-08 17:58:13 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-04-08 18:02:05 +0100 |
commit | 113ec6bf0c8ed1ff12293d1ed2a2de9bd5b9904b (patch) | |
tree | 605580ccbe6b5e5f043453453b380f700ec944ce /src/cairo-traps-compositor.c | |
parent | 6f28f0b33cb12f3b2dd48c87da0018bd00c17107 (diff) | |
download | cairo-113ec6bf0c8ed1ff12293d1ed2a2de9bd5b9904b.tar.gz |
traps: Clip the trapezoid extents against the clip extents
Just in case the clip polygon turns out to be much larger than the
operation extents (silly us for not reducing it correctly) and lead to
catastrophe, such as:
Program received signal SIGSEGV, Segmentation fault.
pixman_fill_sse2 (bits=<optimized out>, stride=4, bpp=8, x=0, y=0,
width=3, height=-34811, data=0) at pixman-sse2.c:3369
3369 *(uint16_t *)d = data;
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-traps-compositor.c')
-rw-r--r-- | src/cairo-traps-compositor.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cairo-traps-compositor.c b/src/cairo-traps-compositor.c index 284a0be0b..c49e208b4 100644 --- a/src/cairo-traps-compositor.c +++ b/src/cairo-traps-compositor.c @@ -218,8 +218,13 @@ combine_clip_as_traps (const cairo_traps_compositor_t *compositor, _cairo_traps_fini (&traps); cairo_surface_destroy (src); - if (status == CAIRO_INT_STATUS_SUCCESS && - (fixup.width < extents->width || fixup.height < extents->height)) { + if (unlikely (status)) + return status; + + if (! _cairo_rectangle_intersect (&fixup, extents)) + return CAIRO_STATUS_SUCCESS; + + if (fixup.width < extents->width || fixup.height < extents->height) { cairo_boxes_t clear; _cairo_boxes_init (&clear); |