If totalTurns are high enough to cause any player's score reaching a certain value, game can never be ended.
totalTurns is set as uint256, yet scoreA and scoreB are only uint8. Because of this, if totalTurns are high enough to breach uint8, then the first attempt of breaching it will cause automatic revert (due to built-in safemath - lowest totalTurns that could trigger this is 511 - without a draw, one player's score will try to reach 256 and keep reverting since the value is off-limit), and since a game with non-zero score is also unable to be cancelled, it will simply get stuck.
Since the game gets stuck in limbo, all the tokens put into the game as bet will be lost. However, realistically, requirements for this sort of bugs to happen is pretty low (since playing a game with more than 500 turns is just too long).
Raise data types of scoreA and scoreB accordingly with totalTurns (namely uint256) to prevent the issue.
Code suggestions or observations that do not pose a direct security risk.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.