diff options
-rw-r--r-- | test/affine-test.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/test/affine-test.c b/test/affine-test.c index ed8000c..a4ceed3 100644 --- a/test/affine-test.c +++ b/test/affine-test.c @@ -99,14 +99,23 @@ test_composite (int testnum, image_endian_swap (dst_img); pixman_transform_init_identity (&transform); - - if (lcg_rand_n (8) > 0) + + if (lcg_rand_n (3) > 0) { - scale_x = -32768 * 3 + lcg_rand_N (65536 * 5); - scale_y = -32768 * 3 + lcg_rand_N (65536 * 5); - translate_x = lcg_rand_N (65536); - translate_y = lcg_rand_N (65536); + scale_x = -65536 * 3 + lcg_rand_N (65536 * 6); + if (lcg_rand_n (2)) + scale_y = -65536 * 3 + lcg_rand_N (65536 * 6); + else + scale_y = scale_x; pixman_transform_init_scale (&transform, scale_x, scale_y); + } + if (lcg_rand_n (3) > 0) + { + translate_x = -65536 * 3 + lcg_rand_N (6 * 65536); + if (lcg_rand_n (2)) + translate_y = -65536 * 3 + lcg_rand_N (6 * 65536); + else + translate_y = translate_x; pixman_transform_translate (&transform, NULL, translate_x, translate_y); } @@ -144,8 +153,23 @@ test_composite (int testnum, pixman_transform_translate (&transform, NULL, tx, ty); } + if (lcg_rand_n (8) == 0) + { + /* Flip random bits */ + int maxflipcount = 8; + while (maxflipcount--) + { + int i = lcg_rand_n (2); + int j = lcg_rand_n (3); + int bitnum = lcg_rand_n (32); + transform.matrix[i][j] ^= 1 << bitnum; + if (lcg_rand_n (2)) + break; + } + } + pixman_image_set_transform (src_img, &transform); - + switch (lcg_rand_n (4)) { case 0: @@ -282,6 +306,6 @@ main (int argc, const char *argv[]) { pixman_disable_out_of_bounds_workaround (); - return fuzzer_test_main ("affine", 8000000, 0x4B5D1852, + return fuzzer_test_main ("affine", 8000000, 0x1EF2175A, test_composite, argc, argv); } |