summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2011-10-25 08:45:34 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2011-10-25 12:00:19 -0400
commit498138c293a2abce44ce122114852f4e6c5b87fe (patch)
treef124ebc6e83cb4bd2884bcb600da8ee43aeda3f6
parent6131707e8fc39187d1d358481f7c57c57cfab206 (diff)
Fix use of uninitialized fields reported by valgrind
In pixman-noop.c and pixman-sse2.c, we are accessing image->bits.width/height without first making sure the image is a bits image. The warning is harmless because we never act on this information without checking that the image is a8r8g8b8, but valgrind does warn about it. In pixman-noop.c, just reorder the clauses in the if statement; in pixman-sse2.c require images to have the FAST_PATH_BITS_IMAGE flag set.
-rw-r--r--pixman/pixman-noop.c6
-rw-r--r--pixman/pixman-sse2.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c
index 906a491..f4012d8 100644
--- a/pixman/pixman-noop.c
+++ b/pixman/pixman-noop.c
@@ -76,12 +76,12 @@ noop_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
{
iter->get_scanline = _pixman_iter_get_scanline_noop;
}
- else if ((iter->flags & ITER_NARROW) &&
+ else if (image->common.extended_format_code == PIXMAN_a8r8g8b8 &&
+ (iter->flags & ITER_NARROW) &&
(image->common.flags & FLAGS) == FLAGS &&
iter->x >= 0 && iter->y >= 0 &&
iter->x + iter->width <= image->bits.width &&
- iter->y + iter->height <= image->bits.height &&
- image->common.extended_format_code == PIXMAN_a8r8g8b8)
+ iter->y + iter->height <= image->bits.height)
{
iter->buffer =
image->bits.bits + iter->y * image->bits.rowstride + iter->x;
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index c419511..8adf541 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -5982,7 +5982,7 @@ sse2_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
int height = iter->height;
#define FLAGS \
- (FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM)
+ (FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM | FAST_PATH_BITS_IMAGE)
if ((iter->flags & ITER_NARROW) &&
(image->common.flags & FLAGS) == FLAGS &&