Skip to content

CBMC malloc should fail if called for a size CBMC cannot represent #4604

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
danielsn opened this issue May 1, 2019 · 2 comments
Closed

CBMC malloc should fail if called for a size CBMC cannot represent #4604

danielsn opened this issue May 1, 2019 · 2 comments
Labels
aws Bugs or features of importance to AWS CBMC users

Comments

@danielsn
Copy link
Contributor

danielsn commented May 1, 2019

I believe that CBMC can only represent allocations of size 2**(64-number-object-bits). And yet

    int *p = malloc(SIZE_MAX);
    assert(p);

succeeds. This should either return NULL, or block with an assume that the input to malloc is a representable size.

@danielsn danielsn added the aws Bugs or features of importance to AWS CBMC users label Nov 15, 2019
@xbauch
Copy link
Contributor

xbauch commented Feb 27, 2020

@danielsn Now that #5210 was merged, this may be resolved. Please have a look at doc/cprover-manual/properties.md for description of the user-options that enable malloc to fail here.

@hannes-steffenhagen-diffblue
Copy link
Contributor

THis has been implemented with the --malloc-may-fail and --malloc-fail-null flags.

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
Projects
None yet
Development

No branches or pull requests

3 participants