Skip to content

Challenge 13: Verify safety of CStr#566

Open
Samuelsills wants to merge 1 commit intomodel-checking:mainfrom
Samuelsills:challenge-13-cstr
Open

Challenge 13: Verify safety of CStr#566
Samuelsills wants to merge 1 commit intomodel-checking:mainfrom
Samuelsills:challenge-13-cstr

Conversation

@Samuelsills
Copy link

Summary

Verify all 14 items listed in Challenge 13. 14 Kani proof harnesses, 0 failures. Bounded verification with MAX_SIZE=32 as permitted by challenge assumptions.

Part 1: Invariant trait for CStr (pre-existing).

Part 2: Harnesses for all 9 safe methods (pre-existing).

Part 3: Contracts and harnesses for all 3 unsafe functions (pre-existing).

Part 4: New harnesses for trait implementations:

  • check_index_range_from: verifies Index<RangeFrom<usize>> preserves the CStr invariant when slicing from any valid start index.
  • check_clone_to_uninit: verifies CloneToUninit copies correct bytes to the destination with no undefined behavior. Note: a formal #[requires] contract could not be added because the safety crate's proc macro does not currently support methods inside unsafe impl Trait blocks. Safety is verified via CBMC's built-in memory model checks.

Resolves #150

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

Verify all 14 items listed in the challenge specification.
14 Kani proof harnesses, 0 failures. Bounded verification with MAX_SIZE=32.

Part 4 additions: check_index_range_from and check_clone_to_uninit.

Resolves model-checking#150

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 and MIT licenses.
@Samuelsills Samuelsills marked this pull request as ready for review March 24, 2026 20:50
@Samuelsills Samuelsills requested a review from a team as a code owner March 24, 2026 20:50
@feliperodri feliperodri added the Challenge Used to tag a challenge label Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Challenge Used to tag a challenge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Challenge 13: Safety of CStr

2 participants