Normally, when the owner finalizes the tournament with setWinner(), the function should strictly ensure that the countryIndex corresponds to a valid, non-empty team name already set in teams[].
However, setWinner() only checks countryIndex < teams.length and does not verify whether teams[countryIndex] actually contains a valid team string. If the country was never initialized in setCountry(), winner may become an empty string, making winner-related logic unreliable and potentially breaking withdrawal conditions.
Likelihood:
Occurs whenever the owner mistakenly sets a winner index before initializing teams properly or when a given slot in teams remains unassigned (empty string).
Can also occur during testing or redeployment phases if setCountry() was never called before setWinner().
Impact:
Impact 1: winner may be empty, making every withdraw() revert since no userToCountry matches an empty string, locking all funds.
Impact 2: Off-chain or front-end systems displaying tournament results may show a blank or incorrect winner, undermining trust and functionality.
Observed Effect:
The contract emits WinnerSet(""), and later withdraw() calls will revert due to failed didNotWin() checks since no user’s userToCountry equals the empty string.
**Explanation: **Adding a simple non-empty string validation ensures the chosen winner is properly initialized and valid. This prevents assigning an empty winner and protects the payout flow from breaking.
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.