From 9ce0a6d93212ffc0986a2b399fd8e9e983f62904 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 5 Feb 2023 12:05:28 +0000 Subject: [PATCH] Pearl: fix bounds check in previous commit. Ahem. That's what I get for testing the fix on a square puzzle. --- pearl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pearl.c b/pearl.c index 04745f3..f6617a2 100644 --- a/pearl.c +++ b/pearl.c @@ -873,7 +873,7 @@ cleanup: for (d = 1; d <= 8; d += d) { int nx = x + DX(d), ny = y + DY(d); int rlink; - if (0 <= nx && nx < w && 0 <= ny && ny < w) + if (0 <= nx && nx < w && 0 <= ny && ny < h) rlink = result[ny*w+nx] & F(d); else rlink = 0; /* off-board squares don't link back */