Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Valid

Function selector is wrong for `MathMasters__MulWadFailed` in `mulWad`

Summary

The issue involves the usage of an incorrect function selector for the MathMasters__MulWadFailed() custom error. The current selector is 0xbac65e5b, but the correct one is 0xa56044f7. This inconsistency may lead to confusion and potential errors in error handling.

Vulnerability Details

The mulWad function in the MathMasters library has an incorrect function selector for the MathMasters__MulWadFailed() custom error. The incorrect selector 0xbac65e5b is used, while the correct selector is 0xa56044f7.

mstore(0x40, 0xbac65e5b) // `MathMasters__MulWadFailed()`. // @audit wrong selector
revert(0x1c, 0x04)

Impact

The incorrect function selector could result in misinterpretation and misidentification of the error during execution. Developers relying on the accurate identification of errors may encounter challenges in handling this specific error case.

POC

  • When I run forge inspect MathMasters errors I get the below result for MathMasters__MulWadFailed but the currently used one is wrong.

{
"MathMasters__MulWadFailed()": "a56044f7"
}

Recommendations

It is recommended to update the function selector in the mulWad function to the correct one (0xa56044f7). This ensures consistency and accuracy in error handling. Additionally, a thorough review of other function selectors in the library is advised to verify their correctness.

mstore(0x40, 0xa56044f7) // `MathMasters__MulWadFailed()`.
revert(0x1c, 0x04)
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Wrong error selector

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.