Slither

Slither

Community Analyzer

If a return is incorrectly used in assembly mode SLITHER-W1023

Anti-pattern
Critical

Detect if return in an assembly block halts unexpectedly the execution.

Exploit Scenario

contract C {
    function f() internal returns (uint a, uint b) {
        assembly {
            return (5, 6)
        }
    }

    function g() returns (bool){
        f();
        return true;
    }
}

The return statement in f will cause execution in g to halt. The function will return 6 bytes starting from offset 5, instead of returning a boolean.

Recommendation

Use the leave statement.

Learn more

incorrect-return on Slither's wiki.