Skip to content

number can be overflow when use operator "++" #3

Description

@longdacao

in the following contract, the field "number" can be overflow to 0 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++;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions