shithub: puzzles

Download patch

ref: d60192531e3ee6b492151f6aa8edd481ebddcdf7
parent: da220a77d1793edd14144fd96584b7f461f06dfb
author: Ben Harris <bjh21@bjh21.me.uk>
date: Wed Jan 11 04:35:51 EST 2023

Insist that Flood grids must have non-zero size

--- a/flood.c
+++ b/flood.c
@@ -210,6 +210,8 @@
 {
     if (params->w < 2 && params->h < 2)
         return "Grid must contain at least two squares";
+    if (params->w < 1 || params->h < 1)
+        return "Width and height must be at least one";
     if (params->w > INT_MAX / params->h)
         return "Width times height must not be unreasonably large";
     if (params->colours < 3 || params->colours > 10)