shithub: puzzles

Download patch

ref: b18c86241d42a0389dd6f9f7441e9cdd2bc7be06
parent: 47e9419452a9fca895f1c84412ab1040d1aa86a5
author: Simon Tatham <anakin@pobox.com>
date: Wed Dec 8 04:37:57 EST 2004

Bah; r4954 introduced an array overrun.

[originally from svn r4955]
[r4954 == 47e9419452a9fca895f1c84412ab1040d1aa86a5]

--- a/pattern.c
+++ b/pattern.c
@@ -330,7 +330,7 @@
             i += runlen;
         }
 
-        if (start[i*step] == GRID_UNKNOWN)
+        if (i < len && start[i*step] == GRID_UNKNOWN)
             return -1;
     }