gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] arraybound violation in 3.3.16


From: Teun Burgers
Subject: [gnugo-devel] arraybound violation in 3.3.16
Date: Fri, 31 Jan 2003 13:06:00 +0100

The attached patch fixes an arraybound violation on pos2
in adjacent_to_nondead_stone in value_moves.c.

The violation occurs in test 2 of filllib.c

Teun
--- 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)) {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]