diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2011-09-12 23:17:39 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2011-09-19 06:15:14 -0400 |
commit | f9faf4df440366ed36b197dc09b1c2b51af3387b (patch) | |
tree | 0aeb47f4f9a2153076b69ad82c20acfe2909739b /test | |
parent | 9623b478f7e872af36ca77af5cc9e85f5ea132cf (diff) |
test: Use smaller boxes in region_contains_test()
The boxes used region_contains_test() sometimes overflow causing
*** BUG ***
In pixman_region32_union_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug
messages to be printed when pixman is compiled with DEBUG. Fix this by
dividing the x, y, w, h coordinates by 4 to prevent overflows.
Diffstat (limited to 'test')
-rw-r--r-- | test/region-contains-test.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/region-contains-test.c b/test/region-contains-test.c index d761c4b..b660fdf 100644 --- a/test/region-contains-test.c +++ b/test/region-contains-test.c @@ -13,14 +13,15 @@ make_random_region (pixman_region32_t *region) n_boxes = lcg_rand_n (64); while (n_boxes--) { - int32_t x1, y1, x2, y2; + int32_t x, y; + uint32_t w, h; - x1 = (int32_t)lcg_rand_u32(); - y1 = (int32_t)lcg_rand_u32(); - x2 = (int32_t)lcg_rand_u32(); - y2 = (int32_t)lcg_rand_u32(); + x = (int32_t)lcg_rand_u32() >> 2; + y = (int32_t)lcg_rand_u32() >> 2; + w = lcg_rand_u32() >> 2; + h = lcg_rand_u32() >> 2; - pixman_region32_union_rect (region, region, x1, y1, x2, y2); + pixman_region32_union_rect (region, region, x, y, w, h); } } @@ -163,7 +164,7 @@ main (int argc, const char *argv[]) { return fuzzer_test_main ("region_contains", 1000000, - 0x86311506, + 0xD7C297CC, test_region_contains_rectangle, argc, argv); } |