solana-program-library icon indicating copy to clipboard operation
solana-program-library copied to clipboard

token-2022: Amount Casting - Imprecision/Overflow - HAL-05

Open joncinque opened this issue 2 years ago • 0 comments

Description

The amount_to_ui_amount and ui_amount_to_amount instructions take an u64 amount and f64 amount, do some arithmetic operations and cast the result to f64 and u64 respectively. When converting/casting between types, an “overflow”/wrapping or mismatch may occur and result in logic bugs.

joncinque avatar Nov 04 '22 14:11 joncinque