Normal Solidity functions use the compiler's return mechanism which handles stack cleanup and memory management. The Token-0x implementation uses direct assembly return() statements in internal functions, bypassing Solidity's built-in return handling and potentially causing stack corruption in complex call scenarios.
The totalSupply_() and _balanceOf() functions use direct assembly returns instead of letting Solidity handle the return values normally
Likelihood:
Every call to totalSupply() and balanceOf() triggers the assembly return pattern
Derived contracts performing complex operations may experience stack inconsistencies
Any function chaining these internal calls inherits the bypass behavior
Impact:
Potential stack corruption in derived contracts with complex call patterns
Inconsistent memory management between assembly and Solidity contexts
Difficulty debugging due to non-standard return patterns
The test demonstrates that while the assembly returns work correctly for basic operations, they bypass Solidity's normal return handling. This pattern is fundamentally unsafe as it skips the compiler's stack cleanup and memory management that normally occurs during function returns.
Replace direct assembly returns with Solidity returns to ensure proper stack cleanup and memory management. The fix should let Solidity handle return values normally while keeping the assembly optimization for the core logic.
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.
The contest is complete and the rewards are being distributed.