mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Correct a range check in Magnets' layout verification
Squares in the grid are numbered from 0, so the upper limit check needs to use "<=" rather than "<". Without this, invalid descriptions can cause a read overrun off the end of the board.
This commit is contained in:
@ -520,7 +520,7 @@ nextchar:
|
||||
* (i.e. each end points to the other) */
|
||||
for (idx = 0; idx < state->wh; idx++) {
|
||||
if (state->common->dominoes[idx] < 0 ||
|
||||
state->common->dominoes[idx] > state->wh ||
|
||||
state->common->dominoes[idx] >= state->wh ||
|
||||
state->common->dominoes[state->common->dominoes[idx]] != idx) {
|
||||
*prob = "Domino descriptions inconsistent";
|
||||
goto done;
|
||||
|
Reference in New Issue
Block a user