simon-git: puzzles (main): Ben Harris
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Sat Jan 28 23:14:47 GMT 2023
TL;DR:
eb1ae3f Forbid moves that fill with the current colour in Flood
e4112b3 Cleanly reject ill-formed solve moves in Flood
28671e7 Don't segfault on premature solve moves in Mines
75e8a1a Limit number of mines in Mines game description
Repository: https://git.tartarus.org/simon/puzzles.git
On the web: https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer: Ben Harris <bjh21 at bjh21.me.uk>
Date: 2023-01-28 23:14:47
commit eb1ae3f3d041f9ff0c11b04613a695be11bda706
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=eb1ae3f3d041f9ff0c11b04613a695be11bda706;hp=a98ac4bb428ab5c1ff665aa1def6cc14d02a4e19
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Jan 28 18:49:47 2023 +0000
Forbid moves that fill with the current colour in Flood
This avoids an assertion failure, "oldcolour != newcolour" in fill(),
by catching it it execute_move(). As far as I know this couldn't be
triggered from the UI, but it could be demonstrated with this save
file:
SAVEFILE:41:Simon Tatham's Portable Puzzle Collection
VERSION :1:1
GAME :5:Flood
PARAMS :1:3
CPARAMS :1:3
DESC :12:231353400,11
NSTATES :1:3
STATEPOS:1:3
MOVE :2:M3
MOVE :2:M3
flood.c | 1 +
1 file changed, 1 insertion(+)
commit e4112b322e299a461ddc46daee741c73733e186d
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=e4112b322e299a461ddc46daee741c73733e186d;hp=eb1ae3f3d041f9ff0c11b04613a695be11bda706
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Jan 28 19:06:24 2023 +0000
Cleanly reject ill-formed solve moves in Flood
A solve move containing characters other than digits and commas would
cause an assertion failure, "*p == ','", in execute_move(). Such a move
can't as far as I know be generated in play, but can be read from a
corrupt save file.
Here's a sample of such a save file:
SAVEFILE:41:Simon Tatham's Portable Puzzle Collection
VERSION :1:1
GAME :5:Flood
PARAMS :7:3x3c6m5
CPARAMS :7:3x3c6m5
DESC :12:403011503,10
NSTATES :1:2
STATEPOS:1:2
SOLVE :2:SA
flood.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
commit 28671e76b736aeb860b1f725898c45fe70ae6212
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=28671e76b736aeb860b1f725898c45fe70ae6212;hp=e4112b322e299a461ddc46daee741c73733e186d
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Jan 28 19:34:28 2023 +0000
Don't segfault on premature solve moves in Mines
If a save file contained a solve move as the first move, Mines would
dereference a null pointer trying to look up the (at that point
undetermined) mine locations. Now execute_move() politely returns
NULL instead.
This save file demonstrates the problem:
SAVEFILE:41:Simon Tatham's Portable Puzzle Collection
VERSION :1:1
GAME :5:Mines
PARAMS :5:3x3n0
CPARAMS :5:3x3n0
DESC :127:r0,u,7a142789cabddc3fc4dcb7d2baa4a4937b33c9613ea870ac098e217981ad339930af585557d62048ea745d05b01475d9699596b394cc0adeebf0440a02
UI :2:D0
TIME :1:0
NSTATES :1:2
STATEPOS:1:2
SOLVE :1:S
mines.c | 1 +
1 file changed, 1 insertion(+)
commit 75e8a1a9cabe7567f6019b1226783b61ba1ac42f
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=75e8a1a9cabe7567f6019b1226783b61ba1ac42f;hp=28671e76b736aeb860b1f725898c45fe70ae6212
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Sat Jan 28 23:12:52 2023 +0000
Limit number of mines in Mines game description
Without this, it's possible to specify a description that has more
mines than there are places on the board to place them, which
eventually leads to a division by zero. This can be demonstrated by
entering a game description of "3:r8,u," and then clicking anywhere on
the board.
mines.c | 2 ++
1 file changed, 2 insertions(+)
More information about the tartarus-commits
mailing list