shithub: puzzles

Download patch

ref: e5d106eb279c12d2454802421e723873e4bae6c2
parent: 38cf1955e5861f67d385ede006c5b5d1701aca8d
author: Ben Harris <bjh21@bjh21.me.uk>
date: Thu Jan 12 16:09:39 EST 2023

Don't allow negative clues in Pattern

--- a/pattern.c
+++ b/pattern.c
@@ -913,6 +913,8 @@
                 p = desc;
                 while (*desc && isdigit((unsigned char)*desc)) desc++;
                 n = atoi(p);
+                if (n < 0)
+                    return "at least one clue is negative";
                 if (n > INT_MAX - 1)
                     return "at least one clue is grossly excessive";
                 rowspace -= n+1;