The transfer_tokens
function uses mint.decimals
as an argument for the transfer_checked
CPI call. However, it does not reload the mint
account before accessing its data field. This can result in the use of an uninitialized or stale decimals
value, which may default to zero if the account was not properly loaded. This behavior is particularly relevant when using InterfaceAccount<'info, Mint>
, where account deserialization is not guaranteed unless reload()
is explicitly called.
This can lead to incorrect transfer behavior, particularly for tokens with non-zero decimal precision, resulting in under- or over-transfer of tokens.
Incorrect transfer amounts for tokens with decimal precision.
Potential financial loss for users interacting with tokens that have decimals greater than 0.
Silent precision bugs that are difficult to detect during normal usage or audits, potentially undermining trust in the system.
Reload the mint account before accessing decimals
to ensure its value is accurate:
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.