Skip to content

Bug in contract replacement with conditional assings clauses #7379

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

Closed
feliperodri opened this issue Nov 23, 2022 · 1 comment · Fixed by #7380
Closed

Bug in contract replacement with conditional assings clauses #7379

feliperodri opened this issue Nov 23, 2022 · 1 comment · Fixed by #7380
Assignees
Labels
aws Bugs or features of importance to AWS CBMC users aws-high bug Code Contracts Function and loop contracts pending merge

Comments

@feliperodri
Copy link
Collaborator

CBMC version: 5.69.1 (cbmc-5.59.0-676-gb4a4122dee)
Operating system: N/A
Exact command line resulting in the issue:

goto-cc main.c -o main.goto
goto-instrument --dfcc main --enforce-contract bar --replace-call-with-contract foo main.goto main-mod.goto
cbmc main-mod.goto --pointer-check

What behaviour did you expect: No failures.
What happened instead: NULL pointer derefecences.

#include<stdlib.h>

void foo(int *out)
__CPROVER_requires(out == NULL || __CPROVER_is_fresh(out, sizeof(*out)))
__CPROVER_assigns(out != NULL : *out)
{
    if(out)
        *out = 1;
}

void bar()
{
    foo(NULL);
}

int main(void)
{
    bar();
}
@feliperodri feliperodri added bug aws Bugs or features of importance to AWS CBMC users aws-high Code Contracts Function and loop contracts labels Nov 23, 2022
@remi-delmas-3000
Copy link
Collaborator

fixed by #7380

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Bugs or features of importance to AWS CBMC users aws-high bug Code Contracts Function and loop contracts pending merge
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants