mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
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!
This commit is contained in:
@ -316,7 +316,9 @@ static inline FourColourMap fourcolourmap_update(
|
|||||||
*/
|
*/
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
/* They should be the same metatile, so have same number of hats! */
|
/* 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)
|
if (f1[i] != 255)
|
||||||
newm.map[f2[i]] = prevm.map[f1[i]];
|
newm.map[f2[i]] = prevm.map[f1[i]];
|
||||||
|
Reference in New Issue
Block a user