SCStudio icon indicating copy to clipboard operation
SCStudio copied to clipboard

number can be overflow when use "**"

Open longdacao opened this issue 4 years ago • 0 comments

in the following contract, the field "number" can be overflow when use function setnumber. And in the report, it doesn't find this issue

contract HelloWorld {
    string name;
    uint8 number;

    constructor() public {
        name = "Hello, World!";
    }

    function get() public view returns (string memory) {
        return name;
    }

    function set(string memory n) public {
        name = n;
    }

    function setnumber() public {
        number = number ** 22;
    }
}

longdacao avatar Feb 02 '21 08:02 longdacao