Fix use of uninitialized fields reported by valgrind
authorSøren Sandmann Pedersen <ssp@redhat.com>
Tue, 25 Oct 2011 12:45:34 +0000 (08:45 -0400)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Tue, 25 Oct 2011 16:00:19 +0000 (12:00 -0400)
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.

pixman/pixman-noop.c
pixman/pixman-sse2.c

index 906a491..f4012d8 100644 (file)
@@ -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;
index c419511..8adf541 100644 (file)
@@ -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                  &&