aboutsummaryrefslogtreecommitdiff
path: root/flood.c
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-01-11 09:35:51 +0000
committerBen Harris <bjh21@bjh21.me.uk>2023-01-15 16:24:27 +0000
commitd60192531e3ee6b492151f6aa8edd481ebddcdf7 (patch)
tree561f444f0362b8dbf164949cb518e764cd8ea241 /flood.c
parentda220a77d1793edd14144fd96584b7f461f06dfb (diff)
downloadpuzzles-d60192531e3ee6b492151f6aa8edd481ebddcdf7.zip
puzzles-d60192531e3ee6b492151f6aa8edd481ebddcdf7.tar.gz
puzzles-d60192531e3ee6b492151f6aa8edd481ebddcdf7.tar.bz2
puzzles-d60192531e3ee6b492151f6aa8edd481ebddcdf7.tar.xz
Insist that Flood grids must have non-zero size
Diffstat (limited to 'flood.c')
-rw-r--r--flood.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/flood.c b/flood.c
index 67181a8..1b0fa6e 100644
--- a/flood.c
+++ b/flood.c
@@ -210,6 +210,8 @@ static const char *validate_params(const game_params *params, bool full)
{
if (params->w < 2 && params->h < 2)
return "Grid must contain at least two squares";
+ if (params->w < 1 || params->h < 1)
+ return "Width and height must be at least one";
if (params->w > INT_MAX / params->h)
return "Width times height must not be unreasonably large";
if (params->colours < 3 || params->colours > 10)