Skip to content

Failure to cast back to &str from &[u8] #241

Closed

Description

@avanhatt

#235 adds the test src/test/cbmc/Strings/copy_empty_string_by_intrinsic_fixme.rs, which has this chunk:

        let dest_slice : &[u8] = from_raw_parts(dest, l);
        let dest_as_str : &str= str::from_utf8(dest_slice).unwrap();
        assert!(dest_as_str.len() == l);

With failures verification with:

[...copy_empty_string_by_intrinsic.assertion.2] line 1035 unreachable code: FAILURE
[...copy_empty_string_by_intrinsic.assertion.1] line 1037 a panicking function std::result::unwrap_failed is invoked: FAILURE
[...copy_string.assertion.2] line 28 assertion failed: dest_as_str.len() == l: FAILURE

Activity

  1. added
    [C] Bug
    on Jun 22, 2021
  2. zhassan-aws commented on Mar 18, 2022

    @zhassan-aws
    Contributor

    @jaisnan Please check if this one is still reproducible.

  3. zhassan-aws commented on Apr 14, 2022

    @zhassan-aws
    Contributor

    This is still reproducible and is due to a missing std function. See this comment for how we plan on addressing this issue: #576 (comment).

  4. self-assigned this
    on Sep 27, 2022
  5. moved this to Done in Kani 0.12on Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[C] Bug

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions