Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: low
Valid

GetActivePlayerIndex returns wrong response

[L-1] GetActivePlayerIndex returns wrong response

Description:

GetActivePlayerIndex method returns 0 idx for non existing entries in players array

Impact:

Low

Tools used:
foundry, manual

Proof of Concept:

function testThatGetActivePlayerResultsInWrongResponse() public playersEntered {
// in modifier players entered we add 4 players - 1,2,3,4
// we check for address that is not being used for sure for example 11111
address nonExistingAddressInRaffle = address(11111);
uint256 idx = puppyRaffle.getActivePlayerIndex(nonExistingAddressInRaffle);
// it returns 0 which is the index of the first player
// so in fact puppyRaffle.getActivePlayerIndex(address(11111)) is the same as puppyRaffle.getActivePlayerIndex(address(1))
assertNotEq(puppyRaffle.players(idx), nonExistingAddressInRaffle);
}
Updates

Lead Judging Commences

Hamiltonite Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

getActivePlayerIndex can say a player is both entered at slot 0 and inactive

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.