ref: 79561485919e0dc867b5c5190c00aa90c5112b37
parent: 2296d6f078f543f8c17d9f9181ec10bd228110f2
author: Simon Tatham <anakin@pobox.com>
date: Sun Apr 2 10:10:31 EDT 2023
hat-test: fix array underrun. Having _checked_ whether a hat index in my four-colouring maps was -1, I then went ahead and used it as an array index anyway, oops!
--- a/auxiliary/hat-test.c
+++ b/auxiliary/hat-test.c
@@ -316,7 +316,9 @@
*/
for (i = 0; i < 4; i++) {
/* They should be the same metatile, so have same number of hats! */
- assert((f1[i] == -1) == (f2[i] == -1));
+ if (f1[i] == -1 && f2[i] == -1)
+ continue;
+ assert(f1[i] != -1 && f2[i] != -1);
if (f1[i] != 255)
newm.map[f2[i]] = prevm.map[f1[i]];