gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] badsgf_3_16.1


From: bump
Subject: [gnugo-devel] badsgf_3_16.1
Date: Fri, 17 Jan 2003 07:17:59 -0800

This patch prevents GNU Go from crashing on a bad sgf file.

- don't crash if sgf file adds a stone where there already is one

Dan

Index: engine/interface.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/interface.c,v
retrieving revision 1.36
diff -u -r1.36 interface.c
--- engine/interface.c  2 Jan 2003 00:23:28 -0000       1.36
+++ engine/interface.c  17 Jan 2003 15:17:00 -0000
@@ -557,14 +557,22 @@
         * placed on the board.
         */
        rotate(i, j, &i, &j, board_size, orientation);
-       gnugo_add_stone(i, j, BLACK);
+       if (BOARD(i, j) != EMPTY)
+         gprintf("Illegal SGF! attempt to add a stone at occupied point %m\n",
+                 i, j);
+       else
+         gnugo_add_stone(i, j, BLACK);
        addstone = 1;
        break;
              
       case SGFAW:
        get_moveXY(prop, &i, &j, board_size);
        rotate(i, j, &i, &j, board_size, orientation);
-       gnugo_add_stone(i, j, WHITE);
+       if (BOARD(i, j) != EMPTY)
+         gprintf("Illegal SGF! attempt to add a stone at occupied point %m\n",
+                 i, j);
+       else
+         gnugo_add_stone(i, j, WHITE);
        addstone = 1;
        break;
              





reply via email to

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