[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] arraybound violation in 3.3.16
From: |
Inge Wallin |
Subject: |
Re: [gnugo-devel] arraybound violation in 3.3.16 |
Date: |
Fri, 31 Jan 2003 13:57:08 +0100 |
Teun Burgers wrote:
> --- value_moves.c.orig 2003-01-31 12:05:33.000000000 +0100
> +++ value_moves.c 2003-01-31 12:07:12.000000000 +0100
> @@ -1299,13 +1299,15 @@
>
> if (trymove(pos, color, NULL, EMPTY, NO_MOVE, EMPTY)) {
> for (k = 0; k < 12; k++) {
> - int pos2;
> - if (k < 8)
> + int pos1, pos2;
> + if (k < 8) {
> pos2 = pos + delta[k];
> - else
> + } else {
> + pos1 = pos + delta[k - 8];
> pos2 = pos + 2 * delta[k - 8];
> + }
>
> - if (ON_BOARD(pos2)
> + if (ON_BOARD(pos1) && ON_BOARD(pos2)
> && worm[pos2].color == color
> && dragon[pos2].status != DEAD
> && !disconnect(pos, pos2, NULL)) {
What happens if k < 8? Looks to me like pos1 is undefined in that
case and the test ON_BOARD(pos1) can give any random result.
-Inge