Skip to content

Constant generator KV equations can overflow #243

@MattWindsor91

Description

@MattWindsor91

Suppose we have a variable x with known value -2147483648, and want to generate the constant 0. The constant generator will consider producing the expression x + 2147483648, which is theoretically valid, but 2147483648 is not expressible as a 32-bit integer. Oops, potential undefined behaviour.

I can't get my brain around the correct way of doing this, but I suspect that the right way to fix this has something to do with breaking the addition/subtraction into two stages: one that adds/subs INT_MAX and one that adds/subs the remainder. This, in turn, needs some caution, because the calculation that produces the new addition/subtraction needs to make sure it doesn't overflow or underflow (though, to be honest, the OCaml integer situation is fishy anyway: see #228).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area:FuzzerSpecifically affecting the program mutatorType:BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions