The mint_range function in the erc721_bridgeable contract is designed to mint a range of tokens from a start value to an end value. This function is part of the ERC721BridgeableMintableImpl implementation, which allows the contract owner to mint multiple tokens in a single transaction. The function iterates from the start value to the end value, calling the mint function for each token ID in the range.
However, the mint_range function does not validate the start and end values before entering the loop. If the start value is greater than or equal to the end value, the function could exhibit unintended behavior. This lack of validation can lead to issues such as minting no tokens or minting tokens in an unexpected manner.
The relevant code snippet is as follows:
The lack of validation in the mint_range function can lead to unintended behavior if the start value is greater than or equal to the end value. This can result in minting no tokens or minting tokens in an unexpected manner, which can disrupt the intended token distribution.
The contract owner calls the mint_range function with start value greater than or equal to the end value.
The function does not mint any tokens because the loop condition if token_id == end { break (); } is immediately met.
Example:
start = 10
end = 5
The loop will terminate immediately, and no tokens will be minted.
Manual review
Add validation to ensure that the start value is less than the end value before entering the loop.
Please, do not suppose impacts, think about the real impact of the bug and check the CodeHawks documentation to confirm: https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity A PoC always helps to understand the real impact possible.
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.