The getCountry function retrieves a country record from a storage array (e.g., countries[index]) without verifying whether the provided index value is within the valid range of the array.
If the index parameter is greater than or equal to the array length, the transaction will revert due to an out-of-bounds array access.
While Solidity automatically reverts in such cases, the lack of explicit validation can lead to unclear error messages, unexpected reverts, and reduced contract robustness when the function is called externally (especially via other contracts or UI interfaces).
Likelihood:
Although Solidity’s runtime reversion prevents direct exploitation, this issue is considered a reliability and UX flaw rather than a critical security vulnerability.
Improper validation could cause external integrations or frontends to fail unexpectedly and make debugging difficult.
In certain upgradeable or complex contract systems, missing validation might propagate unintended revert behavior to other logical flows.
Impact:
No loss of funds or data corruption.
May lead to unexpected transaction failures and degraded user experience.
Could hinder contract composability and integration reliability if other contracts depend on this function.
Accessing a value outside the index range triggers an out-of-bounds panic.
Add an explicit bounds check before accessing the array:
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.