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

Failed Checks: Check that ptr is freeable #3864

Open
thanhnguyen-aws opened this issue Jan 29, 2025 · 0 comments
Open

Failed Checks: Check that ptr is freeable #3864

thanhnguyen-aws opened this issue Jan 29, 2025 · 0 comments
Labels
[C] Bug This is a bug. Something isn't working.

Comments

@thanhnguyen-aws
Copy link
Contributor

I tried this code:

struct Foo {
    vec: Vec<u8>
}

#[kani::requires (e <10)]
#[kani::modifies(f)]
fn foo_push (f: &mut Foo, e: u8) {
    f.vec.push(e);
}


#[kani::proof_for_contract(foo_push)]
fn proof_foo_push_contract () {
    const FOO_SIZE: usize = 2;
    let bytes: [u8; FOO_SIZE] = kani::any();
    let mut f = Foo { vec: bytes.to_vec() };
    let e : u8 = kani::any();
    foo_push(&mut f, e);
}

#[kani::proof]
#[kani::unwind(5)]
fn proof_foo_push_no_contract () {
    const FOO_SIZE: usize = 2;
    let bytes: [u8; FOO_SIZE] = kani::any();
    let mut f = Foo { vec: bytes.to_vec() };
    let e : u8 = kani::any();
    kani::assume(e < 10);
    foo_push(&mut f, e);
} 

using the following command line invocation:

kani src/example.rs -Zfunction-contracts

with Kani version: 0.57.0

I expected to see this happen: the same results for both harnesses proof_foo_push_contract and proof_foo_push_no_contract.

Instead, this happened:

  1. proof_foo_push_contract takes a lot of time and returns "Failed Checks: Check that ptr is freeable"
  2. proof_foo_push_no_contract runs very fast and returns "VERIFICATION:- SUCCESSFUL"
@thanhnguyen-aws thanhnguyen-aws added the [C] Bug This is a bug. Something isn't working. label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Bug This is a bug. Something isn't working.
Projects
None yet
Development

No branches or pull requests

1 participant