Skip to content

Commit 83b9551

Browse files
committed
Prevent out of bound accessing puzzles
1 parent 1ae9f20 commit 83b9551

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

source/code/puzzlehandler.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ int PuzzleNumberOfMovesAllowed(int level) {
4646
}
4747

4848
int PuzzleGetBrick(int level, int x, int y) {
49+
if (level >= maxNrOfPuzzleStages || x >= 6 || y >= 12 || level < 0 || x < 0 || y < 0) {
50+
return -1;
51+
}
4952
return puzzleLevels[level][x][y];
5053
}
5154

0 commit comments

Comments
 (0)