[cairo-commit] src/cairo-image-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Jan 25 01:37:27 PST 2010


 src/cairo-image-surface.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit abcb9d2c39178620b1847fe6ea6e144602464ecc
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jan 25 09:35:09 2010 +0000

    image: Prevent deref of NULL clip_region
    
    Another stray from surface-fallback, spotted by Carlos:
    
    *INT_cairo_region_get_extents (region=0x0, extents=0xbfffce90) at
    cairo-region.c:385
    385         if (region->status) {
    (gdb) bt
    0  *INT_cairo_region_get_extents (region=0x0, extents=0xbfffce90) at
    cairo-region.c:385
    1  0x0013ba46 in _cairo_image_surface_composite_trapezoids
    (op=CAIRO_OPERATOR_OVER, pattern=0xbfffdda8, abstract_dst=0x837de10,
        antialias=CAIRO_ANTIALIAS_DEFAULT, src_x=486, src_y=45, dst_x=0,
    dst_y=0, width=15, height=25, traps=0x837f100, num_traps=30,
    clip_region=0x0)
        at cairo-image-surface.c:4102
    2  0x0015d846 in _cairo_surface_composite_trapezoids
    (op=CAIRO_OPERATOR_OVER, pattern=0xbfffdda8, dst=0x837de10,
    antialias=CAIRO_ANTIALIAS_DEFAULT,
        src_x=486, src_y=45, dst_x=0, dst_y=0, width=15, height=25,
    traps=0x837f100, num_traps=30, clip_region=0x0) at cairo-surface.c:2125
    3  0x001607ce in _cairo_surface_fallback_composite_trapezoids
    (op=CAIRO_OPERATOR_OVER, pattern=0xbfffdda8, dst=0x837db00,
        antialias=CAIRO_ANTIALIAS_DEFAULT, src_x=486, src_y=45, dst_x=486,
    dst_y=45, width=15, height=25, traps=0x837fd78, num_traps=30,
    clip_region=0x0)
        at cairo-surface-fallback.c:1641
    4  0x0015d8a4 in _cairo_surface_composite_trapezoids
    (op=CAIRO_OPERATOR_OVER, pattern=0xbfffdda8, dst=0x837db00,
    antialias=CAIRO_ANTIALIAS_DEFAULT,
        src_x=486, src_y=45, dst_x=486, dst_y=45, width=15, height=25,
    traps=0x837fd78, num_traps=30, clip_region=0x0) at cairo-surface.c:2137
    5  0x001623b0 in _composite_traps_draw_func (closure=0xbfffd350,
    op=CAIRO_OPERATOR_OVER, src=0xbfffdda8, dst=0x837db00, dst_x=0, dst_y=0,
        extents=0xbfffdc78, clip_region=0x0) at cairo-surface-fallback.c:546
    6  0x00161234 in _clip_and_composite (clip=0x0, op=<value optimized
    out>, src=0xbfffdda8, draw_func=0x162310 <_composite_traps_draw_func>,
        draw_closure=0xbfffd350, dst=0x837db00, extents=0xbfffdc78) at
    cairo-surface-fallback.c:463
    7  0x0016205b in _clip_and_composite_trapezoids (src=<value optimized
    out>, op=CAIRO_OPERATOR_OVER, dst=0x837db00, traps=0xbfffd7bc,
        antialias=CAIRO_ANTIALIAS_DEFAULT, clip=0x0, extents=0xbfffdc78) at
    cairo-surface-fallback.c:853
    8  0x001626ef in _cairo_surface_fallback_stroke (surface=0x837db00,
    op=CAIRO_OPERATOR_OVER, source=0xbfffdda8, path=0x1b164c,
    stroke_style=0x1b1524,
        ctm=0x1b15b0, ctm_inverse=0x1b15e0, tolerance=0.10000000000000001,
    antialias=CAIRO_ANTIALIAS_DEFAULT, clip=0x0) at
    cairo-surface-fallback.c:1173
    9  0x0015f2f4 in _cairo_surface_stroke (surface=0x837db00,
    op=CAIRO_OPERATOR_OVER, source=0xbfffdda8, path=0x1b164c,
    stroke_style=0x1b1524, ctm=0x1b15b0,
        ctm_inverse=0x1b15e0, tolerance=0.10000000000000001,
    antialias=CAIRO_ANTIALIAS_DEFAULT, clip=0xbfffde88) at
    cairo-surface.c:2041
    10 0x00134629 in _cairo_gstate_stroke (gstate=0x1b1514, path=0x1b164c)
    at cairo-gstate.c:1133
    11 0x0012a706 in *INT_cairo_stroke_preserve (cr=0x1b13c0) at
    cairo.c:2234
    12 0x0012a732 in *INT_cairo_stroke (cr=0x1b13c0) at cairo.c:2207

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index beab9d7..a29191d 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -4099,7 +4099,15 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t	op,
     extents.bounded.width  = width;
     extents.bounded.height = height;
 
-    cairo_region_get_extents (clip_region, &extents.unbounded);
+    if (clip_region != NULL) {
+	cairo_region_get_extents (clip_region, &extents.unbounded);
+    } else {
+	extents.unbounded.x = 0;
+	extents.unbounded.y = 0;
+	extents.unbounded.width  = dst->width;
+	extents.unbounded.height = dst->height;
+    }
+
     extents.is_bounded = _cairo_operator_bounded_by_either (op);
 
     if (clip_region != NULL) {


More information about the cairo-commit mailing list