Skip to content

byte_update against a pointer shouldn't be fatal #4185

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

Conversation

smowton
Copy link
Contributor

@smowton smowton commented Feb 13, 2019

This can happen in inaccessible code, so it doesn't seem necessary to kill the whole process.

For example, a program might do something like

f(bool unknown) {
  int i = 0;
  void *ptr = nullptr;
  void *i_or_ptr = unknown ? &i : &ptr;
  if(unknown)
    ((int*)i_or_ptr) = 1;
}

This doesn't do anything unsafe, but symex might produce a byte-update against ptr regardless based on the incorrect assumption that unknown may have changed between lines 4 and 5. Therefore I argue we shouldn't unconditionally reject such an expression.

I raise this now because with #3725 applied we get byte-update expressions against pointers which were previously hidden as byte-extract + with. The meaning of the expression is the same, but it trips this path, indicating the invariant also fails to find all cases where pointers are updated byte-wise.

This can happen in inaccessible code, so it doesn't seem necessary to kill the whole process
@tautschnig
Copy link
Collaborator

Hmm, maybe I could instead get #4121 reviewed so that I can make progress on #2068 and the PRs I'm factoring out from it? Once #2068 is in we shouldn't have any byte operations on pointers hitting the back-end anymore. Let's please not allow unsoundness creep back in.

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️
Passed Diffblue compatibility checks (cbmc commit: b778bea).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100824571

@smowton
Copy link
Contributor Author

smowton commented Feb 14, 2019

Marking do not merge on the assumption #2068 makes this redundant

@smowton
Copy link
Contributor Author

smowton commented Feb 19, 2019

It did indeed

@smowton smowton closed this Feb 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants