Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhassan-aws committed Oct 9, 2024
1 parent fd39cfc commit 14c143b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/expected/offset-overflow/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ use std::intrinsics::offset;

#[kani::proof]
fn test_offset_overflow() {
let s: &str = "123";
let ptr: *const u8 = s.as_ptr();
let a: [i32; 3] = [1, 2, 3];
let ptr: *const i32 = a.as_ptr();

// a value that when multiplied by the size of i32 (i.e. 4 bytes)
// would overflow `isize`
let count: isize = isize::MAX / 4 + 1;
unsafe {
let _d = offset(ptr, isize::MAX / 8);
let _d = offset(ptr, count);
}
}

0 comments on commit 14c143b

Please sign in to comment.