Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions shared/src/games/tic-tac-toe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,15 @@ export class TicTacToeGame implements Game<TicTacToeGameState, TicTacToeMove> {
return false;
}

// Check if the move is within bounds
if (row < 0 || row >= 3 || col < 0 || col >= 3) {
// Check that row and col are numbers, integers, and not special property names
if (
typeof row !== 'number' ||
typeof col !== 'number' ||
!Number.isInteger(row) ||
!Number.isInteger(col) ||
row < 0 || row >= 3 ||
col < 0 || col >= 3
) {
return false;
}

Expand Down