mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
Map: reduce maximum size
validate_desc relies on being able to calculate 2*wh in an int, so the maximum grid size is at most INT_MAX/2.
This commit is contained in:
2
map.c
2
map.c
@ -255,7 +255,7 @@ static const char *validate_params(const game_params *params, bool full)
|
||||
{
|
||||
if (params->w < 2 || params->h < 2)
|
||||
return "Width and height must be at least two";
|
||||
if (params->w > INT_MAX / params->h)
|
||||
if (params->w > INT_MAX / 2 / params->h)
|
||||
return "Width times height must not be unreasonably large";
|
||||
if (params->n < 5)
|
||||
return "Must have at least five regions";
|
||||
|
Reference in New Issue
Block a user