From 52d801a06a804244292f4a872eeaf5e84a9f70b1 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Fri, 31 Mar 2023 15:33:51 +0100 Subject: [PATCH] Require a grid description for hats grid Without this, you can cause a null-pointer dereference by passing Loopy a game description with no grid description, like "10x10t16:". --- grid.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/grid.c b/grid.c index bac8be8..c2e08db 100644 --- a/grid.c +++ b/grid.c @@ -3496,6 +3496,9 @@ static const char *grid_validate_desc_hats( struct HatPatchParams hp; const char *error = NULL; + if (!desc) + return "Missing grid description string."; + error = grid_desc_to_hat_params(desc, &hp); if (!error) error = hat_tiling_params_invalid(&hp);