chiark / gitweb /
valgrind spotted this array underrun. I wonder if this might have
authorSimon Tatham <anakin@pobox.com>
Tue, 31 May 2005 17:46:22 +0000 (17:46 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 31 May 2005 17:46:22 +0000 (17:46 +0000)
been causing some of Verity's nonreproducible weirdnesses.

[originally from svn r5884]

mines.c

diff --git a/mines.c b/mines.c
index 5023faadd84579463c3766bc030b43463bea464b..a6562f6bf491454d4e811c0cf1a1ed022d82f390 100644 (file)
--- a/mines.c
+++ b/mines.c
@@ -1086,7 +1086,7 @@ static int minesolve(int w, int h, int n, signed char *grid,
                         * next. Backtrack cursor to the nearest 1,
                         * change it to a 0 and continue.
                         */
-                       while (cursor-- >= 0 && !setused[cursor]);
+                       while (--cursor >= 0 && !setused[cursor]);
                        if (cursor >= 0) {
                            assert(setused[cursor]);