Incorrect Condition Check in decodeWellData
Function
#28
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-17
🤖_09_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
upgraded by judge
Original issue severity upgraded from QA/Gas by judge
Lines of code
https://github.com/code-423n4/2024-07-basin/blob/7d5aacbb144d0ba0bc358dfde6e0cc913d25310e/src/functions/Stable2.sol#L314-L318
Vulnerability details
The
decodeWellData
function is supposed to decode the decimals of two tokens from the provided data.If the decoded values are 0, it should default them to 18.
However, the function mistakenly checks
decimal0
twice, potentially leavingdecimal1
unchanged if it is 0.Impact
This logical error can lead to incorrect defaulting of
decimal1
if it is 0, causing potential inaccuracies in subsequent calculations that rely on the token decimals.This might affect the stability and reliability of the contract's functions.
Proof of Concept
The current implementation of the
decodeWellData
function incorrectly checksdecimal0
twice:This should be corrected to:
Tools Used
Manual Review
Recommended Mitigation Steps
Correct the condition in the
decodeWellData
function to checkdecimal1
instead ofdecimal0
in the second condition.Assessed type
Error
The text was updated successfully, but these errors were encountered: