gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] 2 arraybound violations in 3.1.17


From: Teun Burgers
Subject: [gnugo-devel] 2 arraybound violations in 3.1.17
Date: Mon, 17 Dec 2001 12:16:53 +0100

Here are 2 more arraybound violations.
The one in owl.c (no fix, assertion added) is triggered by owl test 149.

The one in readconnect.c (with fix, please check) was triggered
by connect.tst test 3.

There are still more arraybound violations, more info will follow.

The rate at which arraybound violations are introduced/exposed in the program
makes one wonder about the number of other less easy to detect bugs that is
there ...

Teun

--- owl.c.orig  Mon Dec 17 11:50:23 2001
+++ owl.c       Mon Dec 17 11:51:38 2001
@@ -3936,6 +3936,7 @@
    * escaping inwards. Returning a negative value is just a kludge.
    */
   int k;
+  ASSERT_ON_BOARD1(pos);
   if (current_owl_data->goal[pos])
     return -10;
 
--- readconnect.c.orig  Mon Dec 17 11:57:45 2001
+++ readconnect.c       Mon Dec 17 12:00:53 2001
@@ -612,8 +612,9 @@
         */
        for (k = 0; k < 8; k++) {
          if (!does_connect
-             || secondlib1[libs[s] + delta[k]]
-             || secondlib2[libs[s] + delta[k]]) {
+             || ON_BOARD1(libs[s] + delta[k]) &&
+               (secondlib1[libs[s] + delta[k]] ||
+                secondlib2[libs[s] + delta[k]])) {
            add_array(moves, libs[s]);
            break;
          }



reply via email to

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