diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-01-10 20:39:06 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-01-15 16:24:27 +0000 |
| commit | c53e0d386793840ad84b8bbcb4760cfb2b6897d4 (patch) | |
| tree | c650f8ade1bf40f767a70def7e0735ad4d188d63 | |
| parent | 07999443c24414602cf046fefc84d1d17b5afd69 (diff) | |
| download | puzzles-c53e0d386793840ad84b8bbcb4760cfb2b6897d4.zip puzzles-c53e0d386793840ad84b8bbcb4760cfb2b6897d4.tar.gz puzzles-c53e0d386793840ad84b8bbcb4760cfb2b6897d4.tar.bz2 puzzles-c53e0d386793840ad84b8bbcb4760cfb2b6897d4.tar.xz | |
Last-ditch maximum size limit for Tracks
This makes sure that width * height <= INT_MAX, which it rather needs
to be.
| -rw-r--r-- | tracks.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -20,6 +20,7 @@ #include <string.h> #include <assert.h> #include <ctype.h> +#include <limits.h> #include <math.h> #include "puzzles.h" @@ -196,6 +197,8 @@ static const char *validate_params(const game_params *params, bool full) */ if (params->w < 4 || params->h < 4) return "Width and height must both be at least four"; + if (params->w > INT_MAX / params->h) + return "Width times height must not be unreasonably large"; return NULL; } |