Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constant generator KV equations can overflow #243

Open
MattWindsor91 opened this issue Nov 23, 2020 · 0 comments
Open

Constant generator KV equations can overflow #243

MattWindsor91 opened this issue Nov 23, 2020 · 0 comments
Labels
Area:Fuzzer Specifically affecting the program mutator Type:Bug Something isn't working

Comments

@MattWindsor91
Copy link
Collaborator

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).

@MattWindsor91 MattWindsor91 added Type:Bug Something isn't working Area:Fuzzer Specifically affecting the program mutator labels Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Fuzzer Specifically affecting the program mutator Type:Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant