Fix dangling-pointer bug in bits_image_fetch_bilinear_no_repeat_8888().
authorSøren Sandmann Pedersen <ssp@redhat.com>
Mon, 17 Jan 2011 19:12:20 +0000 (14:12 -0500)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Wed, 19 Jan 2011 12:22:42 +0000 (07:22 -0500)
The mask_bits variable is only declared in a limited scope, so the
pointer to it becomes invalid instantly. Somehow this didn't actually
trigger any bugs, but Brent Fulgham reported that Bounds Checker was
complaining about it.

Fix the bug by moving mask_bits to the function scope.

pixman/pixman-bits-image.c

index 98a2b6d..a865d71 100644 (file)
@@ -295,6 +295,7 @@ bits_image_fetch_bilinear_no_repeat_8888 (pixman_image_t * ima,
     uint32_t *bottom_row;
     uint32_t *end;
     uint32_t zero[2] = { 0, 0 };
+    uint32_t one = 1;
     int y, y1, y2;
     int disty;
     int mask_inc;
@@ -360,10 +361,8 @@ bits_image_fetch_bilinear_no_repeat_8888 (pixman_image_t * ima,
      */
     if (!mask)
     {
-       uint32_t mask_bits = 1;
-
         mask_inc = 0;
-        mask = &mask_bits;
+        mask = &one;
     }
     else
     {