We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent db71987 commit ca85f7fCopy full SHA for ca85f7f
library/core/src/ffi/c_str.rs
@@ -885,7 +885,20 @@ mod verify {
885
assert!(c_str.is_safe());
886
}
887
888
-
+
889
+ #[kani::proof]
890
+ #[kani::unwind(17)]
891
+ fn check_from_bytes_with_nul() {
892
+ const MAX_SIZE: usize = 16;
893
+ let string: [u8; MAX_SIZE] = kani::any();
894
+ let slice = kani::slice::any_slice_of_array(&string);
895
896
+ let result = CStr::from_bytes_with_nul(slice);
897
+ if let Ok(c_str) = result {
898
+ assert!(c_str.is_safe());
899
+ }
900
901
902
// pub const fn count_bytes(&self) -> usize
903
#[kani::proof]
904
#[kani::unwind(32)]
@@ -956,4 +969,4 @@ mod verify {
956
969
assert_eq!(expected_is_empty, c_str.is_empty());
957
970
958
971
959
-}
972
+}
0 commit comments