[cairo] pixman crash from setting clip region on image surface
(patch)
Vladimir Vukicevic
vladimir at pobox.com
Wed May 5 20:21:37 PDT 2004
Hi,
If an cairo_init_clip is called on an image surface,
_cairo_image_surface_set_clip_region ends up with a NULL region, which
it then passes to pixman_image_set_clip_region.
pixman_image_set_clip_region assumes that the region is valid, and sets
up the clip type accordingly; this causes a crash later on when the
region is reset, because it tries to free NULL.
The attached patch fixes this; just a patch to icimage.c to check if the
region is not NULL before setting a new clipping region.
- Vlad
-------------- next part --------------
Index: src/icimage.c
===================================================================
RCS file: /cvs/cairo/libpixman/src/icimage.c,v
retrieving revision 1.19
diff -u -u -r1.19 icimage.c
--- src/icimage.c 16 Apr 2004 15:32:53 -0000 1.19
+++ src/icimage.c 6 May 2004 03:19:10 -0000
@@ -263,8 +263,10 @@
pixman_region16_t *region)
{
pixman_image_destroyClip (image);
- image->clientClip = region;
- image->clientClipType = CT_REGION;
+ if (region != NULL) {
+ image->clientClip = region;
+ image->clientClipType = CT_REGION;
+ }
image->stateChanges |= CPClipMask;
return 0;
}
More information about the cairo
mailing list