[Pixman] [PATCH 1/1] Fix dangling-pointer bug in bits_image_fetch_bilinear_no_repeat_8888().

Søren Sandmann sandmann at cs.au.dk
Mon Jan 17 11:15:41 PST 2011


From: Søren Sandmann Pedersen <ssp at redhat.com>

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 |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index c453e0e..94ce245 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -297,6 +297,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;
@@ -362,10 +363,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
     {
-- 
1.6.0.6



More information about the Pixman mailing list