From c6e0161dd475415316ed66dc82794d68e52f0025 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 25 Mar 2018 22:27:38 +0100 Subject: [PATCH] Fix false-positive completion detection in X Solo. Spotted by Michael Quevillon. After checking the set of digits appearing in one of the two main grid diagonals, we weren't clearing the used[] array before using it to check the same thing about the other diagonal. So if the first diagonal we check has one of everything, then the second will be misidentified as correct (for the purposes of game-completion detection, although not error highlighting) even if it doesn't have one of everything. --- solo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/solo.c b/solo.c index dd04cdf..e72b14f 100644 --- a/solo.c +++ b/solo.c @@ -3103,6 +3103,8 @@ static int check_valid(int cr, struct block_structure *blocks, sfree(used); return FALSE; } + + memset(used, FALSE, cr); for (i = 0; i < cr; i++) if (grid[diag1(i)] > 0 && grid[diag1(i)] <= cr) used[grid[diag1(i)]-1] = TRUE;