From 393ccab74e9aa466e2fdd91319012e2c18f4ef84 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Mon, 16 Aug 2010 07:24:48 -0400 Subject: [PATCH] Only try to compute the FAST_SAMPLES_COVER_CLIP for bits images It doesn't make sense in other cases, and the computation would make use of image->bits.{width,height} which lead to uninitialized memory accesses when the image wasn't of type BITS. --- pixman/pixman.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pixman/pixman.c b/pixman/pixman.c index 55c5981..ddd4935 100644 --- a/pixman/pixman.c +++ b/pixman/pixman.c @@ -787,14 +787,17 @@ analyze_extent (pixman_image_t *image, int x, int y, if (!compute_sample_extents (transform, &ex, x, y, x_off, y_off, width, height)) return FALSE; - /* Check whether the non-expanded, transformed extent is entirely within - * the source image, and set the FAST_PATH_SAMPLES_COVER_CLIP if it is. - */ - ex = *extents; - if (compute_sample_extents (transform, &ex, x, y, x_off, y_off, width, height)) + if (image->type == BITS) { - if (ex.x1 >= 0 && ex.y1 >= 0 && ex.x2 <= image->bits.width && ex.y2 <= image->bits.height) - *flags |= FAST_PATH_SAMPLES_COVER_CLIP; + /* Check whether the non-expanded, transformed extent is entirely within + * the source image, and set the FAST_PATH_SAMPLES_COVER_CLIP if it is. + */ + ex = *extents; + if (compute_sample_extents (transform, &ex, x, y, x_off, y_off, width, height)) + { + if (ex.x1 >= 0 && ex.y1 >= 0 && ex.x2 <= image->bits.width && ex.y2 <= image->bits.height) + *flags |= FAST_PATH_SAMPLES_COVER_CLIP; + } } return TRUE; -- 2.7.4