shithub: puzzles

Download patch

ref: 52d801a06a804244292f4a872eeaf5e84a9f70b1
parent: e6aa7ab6dd219d92b332c3662de95c28f7bd6b8f
author: Ben Harris <bjh21@bjh21.me.uk>
date: Fri Mar 31 11:33:51 EDT 2023

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:".

--- a/grid.c
+++ b/grid.c
@@ -3496,6 +3496,9 @@
     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);