chiark
/
gitweb
/
~ian
/
sgt-puzzles.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8c547d5
)
Fix array bounds violation in the solver. Oops.
author
Simon Tatham
<anakin@pobox.com>
Sat, 27 Aug 2005 09:53:38 +0000
(09:53 +0000)
committer
Simon Tatham
<anakin@pobox.com>
Sat, 27 Aug 2005 09:53:38 +0000
(09:53 +0000)
[originally from svn r6225]
inertia.c
patch
|
blob
|
history
diff --git
a/inertia.c
b/inertia.c
index a158363adb1807facbb80ef780b4362400cb948d..fc213da2deeeda860759002f885f72ee6f136136 100644
(file)
--- a/
inertia.c
+++ b/
inertia.c
@@
-370,7
+370,9
@@
static int find_gem_candidates(int w, int h, char *grid,
d2 = n;
}
i2 = (y2*w+x2)*DIRECTIONS+d2;
- if (!reachable[i2]) {
+ if (x2 >= 0 && x2 < w &&
+ y2 >= 0 && y2 < h &&
+ !reachable[i2]) {
int ok;
#ifdef SOLVER_DIAGNOSTICS
printf(" trying point %d,%d,%d", x2, y2, d2);