summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2010-03-17 21:07:06 +0000
committerSøren Sandmann Pedersen <ssp@redhat.com>2010-03-17 20:25:25 -0400
commit69f1ec9a7827aeb522fcae99846237ef0f896e7b (patch)
treec1522b3465d9f8f234eacb891102ce139479acba
parent50713d9d0d9241597724551315f05d958ce7a283 (diff)
Avoid a potential division-by-zero exeception in window-test
Avoid a division-by-zero exception if the first number returned by rand() is a multiple of 500, causing us to create a zero width pixmap, and then attempt to use get_rand(0) when generating a random stride... Fixes https://bugs.freedesktop.org/attachment.cgi?id=34162
-rw-r--r--test/window-test.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/window-test.c b/test/window-test.c
index 084e23a2..919fc16e 100644
--- a/test/window-test.c
+++ b/test/window-test.c
@@ -137,8 +137,8 @@ main ()
pixman_image_t *src, *dest;
int src_x, src_y, dest_x, dest_y;
int i, j;
- int width = get_rand (500);
- int height = get_rand (500);
+ int width = get_rand (499) + 1;
+ int height = get_rand (499) + 1;
src = make_image (width, height, TRUE, &src_x, &src_y);
dest = make_image (width, height, FALSE, &dest_x, &dest_y);