You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Requested feature: byte-by-byte object comparison API
Use case: Compare and check whether two objects pointed by two pointers have the same value byte-by-byte up till a specific size. Something like:
Another example is to compare an aligned and intentionally unaligned pointer to see if they point to the same sequence of n bytes:
// aligned_ptr is *const u8, unaligned_ptr is *const usize, both pointing to the same array of u8 elementslet result = kani::compare_byte_by_byte(aligned_ptr, unaligned_ptr as*constu8, mem::size_of<usize>);
As @celinval explained to me, adding a generic API is tricky because of padding bytes. So, the comparison will likely have to implemented for specific types in which we can guarantee a UB-free comparison.
…_raw_parts`, `to_raw_parts` in NonNull (#127)
Towards #53
Contracts and harnesses for `dangling`, `from_raw_parts`,
`slice_from_raw_parts`, `to_raw_parts` in NonNull
### Discussion
1. `NonNull::slice_from_raw_parts`:
[requested](model-checking/kani#3693) new Kani
API to compare byte by byte
2. `NonNull::to_raw_parts`: [unstable vtable comparison
'Eq'](#139)
### Verification Result
```
SUMMARY:
** 0 of 141 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 0.17378491s
Complete - 6 successfully verified harnesses, 0 failures, 6 total.
```
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.
Requested feature: byte-by-byte object comparison API
Use case: Compare and check whether two objects pointed by two pointers have the same value byte-by-byte up till a specific size. Something like:
For example, we want to compare the result with the data that was passed in:
Another example is to compare an aligned and intentionally unaligned pointer to see if they point to the same sequence of n bytes:
@zhassan-aws
The text was updated successfully, but these errors were encountered: