diff --git a/signpost.c b/signpost.c index 1c8cfee..daf5509 100644 --- a/signpost.c +++ b/signpost.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "puzzles.h" @@ -421,6 +422,8 @@ static const char *validate_params(const game_params *params, bool full) { if (params->w < 1) return "Width must be at least one"; if (params->h < 1) return "Height must be at least one"; + if (params->w > INT_MAX / params->h) + return "Width times height must not be unreasonably large"; if (full && params->w == 1 && params->h == 1) /* The UI doesn't let us move these from unsolved to solved, * so we disallow generating (but not playing) them. */