From 9e2e0692ed087dbe0d5f4abbddf3aebd6a11b30e Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Tue, 10 Jan 2023 00:22:57 +0000 Subject: [PATCH] Also check for tiny grids in Mines A zero-size grid isn't acceptable even if someone has generated it for us. --- mines.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mines.c b/mines.c index c933f49..25b2206 100644 --- a/mines.c +++ b/mines.c @@ -261,6 +261,8 @@ static const char *validate_params(const game_params *params, bool full) */ if (full && params->unique && (params->w <= 2 || params->h <= 2)) return "Width and height must both be greater than two"; + if (params->w < 1 || params->h < 1) + return "Width and height must both be at least one"; if (params->w > INT_MAX / params->h) return "Width times height must not be unreasonably large"; if (params->n < 0)