Skip to content

Commit 1632b67

Browse files
committed
Fix tests after enabling offset bound checks
1 parent ed7e698 commit 1632b67

File tree

15 files changed

+29
-32
lines changed

15 files changed

+29
-32
lines changed

tests/expected/intrinsics/copy-nonoverlapping/copy-unreadable-src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ fn test_copy_nonoverlapping_invalid() {
77
let arr: [i32; 3] = [0, 1, 0];
88
let src: *const i32 = arr.as_ptr();
99

10+
// Get an invalid pointer with a negative offset
11+
let src_invalid = src.wrapping_sub(1) as *const i32;
12+
let dst = src.wrapping_add(1) as *mut i32;
1013
unsafe {
11-
// Get an invalid pointer with a negative offset
12-
let src_invalid = unsafe { src.sub(1) as *const i32 };
13-
let dst = src.add(1) as *mut i32;
1414
core::intrinsics::copy_nonoverlapping(src_invalid, dst, 1);
1515
}
1616
}

tests/expected/intrinsics/copy/copy-unreadable-src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ fn test_copy_invalid() {
77
let arr: [i32; 3] = [0, 1, 0];
88
let src: *const i32 = arr.as_ptr();
99

10+
// Get an invalid pointer with a negative offset
11+
let src_invalid = src.wrapping_sub(1) as *const i32;
12+
let dst = src.wrapping_add(1) as *mut i32;
1013
unsafe {
11-
// Get an invalid pointer with a negative offset
12-
let src_invalid = unsafe { src.sub(1) as *const i32 };
13-
let dst = src.add(1) as *mut i32;
1414
core::intrinsics::copy(src_invalid, dst, 1);
1515
}
1616
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Failed Checks: Offset result is out of bounds of initial allocation
1+
Failed Checks: Offset result and original pointer should point to the same allocation
22
Verification failed for - check_ptr_oob
33

44
Complete - 1 successfully verified harnesses, 1 failures, 2 total.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Failed Checks: Offset result is out of bounds of initial allocation
1+
Failed Checks: Offset result and original pointer should point to the same allocation
22
Verification failed for - check_add_to_oob
33

44
Complete - 0 successfully verified harnesses, 1 failures, 1 total.
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
FAILURE\
2-
offset: attempt to compute number in bytes which would overflow
1+
Failed Checks: Offset in bytes overflow isize
2+
Verification failed for - check_wrap_offset
3+
4+
Complete - 0 successfully verified harnesses, 1 failures, 1 total.
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
FAILURE\
2-
attempt to compute number in bytes which would overflow
1+
Failed Checks: Offset in bytes overflow isize
2+
Verification failed for - main
3+
4+
Complete - 0 successfully verified harnesses, 1 failures, 1 total.
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
FAILURE\
2-
attempt to compute offset which would overflow
1+
Failed Checks: Offset result and original pointer should point to the same allocation
2+
Verification failed for - test_offset_overflow
3+
4+
Complete - 0 successfully verified harnesses, 1 failures, 1 total.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
Status: FAILURE\
2-
offset: attempt to compute number in bytes which would overflow
1+
Failed Checks: Offset in bytes overflow isize

tests/expected/pointer-overflow/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright Kani Contributors
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33
//
4-
// kani-flags: --enable-unstable --extra-pointer-checks
54
// Checks that overflows for pointer arithmetic are reported
65

76
#[kani::proof]
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
std::ptr::const_ptr::<impl *const Foo>::offset.arithmetic_overflow\
2-
Status: FAILURE\
3-
Description: "offset: attempt to compute number in bytes which would overflow"
4-
5-
VERIFICATION:- FAILED
1+
Failed Checks: Offset in bytes overflow isize
2+
Verification failed for - main
3+
Complete - 0 successfully verified harnesses, 1 failures, 1 total.

0 commit comments

Comments
 (0)