gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] A problem in atari_atari


From: Daniel Bump
Subject: [gnugo-devel] A problem in atari_atari
Date: Wed, 12 Dec 2001 10:35:33 -0800

My current working version of the semeai code (which you
haven't seen) causes a crash in the atari_atari code in
nicklas2 test 1401. Or from the command line:

gnugo -l nicklas14.sgf -L31 -d0x040 -t --quiet

It does this by changing the status of B1 from DEAD to
CRITICAL. Note that B1 can be rescued with ko.

Now atari_atari_confirm_safety(A2) gets a crash at
line 641 of combination.c after W:A2 B:A1 because
B's move has captured str.

The stone at B1 should not be classified as critical
and I'll have to fix this in the semeai code. However
it still seems to me that there will be a potential
for a crash at line 641 of combination.c in error
situations. Probably str should be tested for
emptiness and if this happens the conservative conclusion
would be to conclude that there is no combination.

Thus I propose the following. This includes the previous
patch.

Dan


Index: engine/combination.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/combination.c,v
retrieving revision 1.10
diff -u -r1.10 combination.c
--- engine/combination.c        5 Dec 2001 19:49:20 -0000       1.10
+++ engine/combination.c        12 Dec 2001 18:24:31 -0000
@@ -637,6 +637,12 @@
     if (!trymove(apos, color, "do_atari_atari-A", str, EMPTY, NO_MOVE))
       continue;
        
+    if (!IS_STONE(str)) {
+      /* Error situation */
+      popgo();
+      return 0;
+    }
+
     /* Try to defend the stone (str) which is threatened. */
     aa_val = countstones(str);
 
Index: engine/reading.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
retrieving revision 1.38
diff -u -r1.38 reading.c
--- engine/reading.c    10 Dec 2001 17:22:40 -0000      1.38
+++ engine/reading.c    12 Dec 2001 18:25:21 -0000
@@ -895,12 +895,10 @@
 
        for (r = -1; r < max_points; r++) {
          /* -1 is used only when stackp > 0. */
-         if (stackp > 0) {
-           if (r == -1)
-             bb = dd;
-           else
-             break;
-         }
+         if (r == -1 && stackp > 0)
+           break;
+         if (r == -1)
+           bb = dd;
          else {
            if (worm[adjs[k]].defend_codes[r] == 0)
              break;





reply via email to

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