The tokenURI function attempts to check token ownership, but it does not properly handle non-existent tokens before calling ownerOf(tokenId).
Calling tokenURI on an invalid tokenId may cause unexpected behavior or unnecessary computation.
A missing check could result in reverting transactions where they should return a clean error.
ownerOf(tokenId) reverts if tokenId doesn't exist, which is inefficient.
The correct approach is to use _exists(tokenId), which is provided by OpenZeppelin’s ERC721 implementation.
Change the tokenURI function to:
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.