Skip to content

Commit 4b64baf

Browse files
committed
Bless out_of_bounds_read test
1 parent 22fe76d commit 4b64baf

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

src/test/ui/const-ptr/out_of_bounds_read.stderr

+29-26
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
error: any use of this value will cause an error
2-
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
3-
|
4-
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6-
| |
7-
| memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4
8-
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
9-
| inside `_READ` at $DIR/out_of_bounds_read.rs:13:33
2+
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL
3+
|
4+
LL | unsafe { copy_nonoverlapping(src, dst, count) }
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
| |
7+
| memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4
8+
| inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL
9+
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
10+
| inside `_READ` at $DIR/out_of_bounds_read.rs:13:33
1011
|
1112
::: $DIR/out_of_bounds_read.rs:13:5
1213
|
@@ -18,15 +19,16 @@ LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) };
1819
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
1920

2021
error: any use of this value will cause an error
21-
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
22-
|
23-
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
24-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25-
| |
26-
| memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4
27-
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
28-
| inside `ptr::const_ptr::<impl *const u32>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
29-
| inside `_CONST_READ` at $DIR/out_of_bounds_read.rs:14:39
22+
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL
23+
|
24+
LL | unsafe { copy_nonoverlapping(src, dst, count) }
25+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26+
| |
27+
| memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4
28+
| inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL
29+
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
30+
| inside `ptr::const_ptr::<impl *const u32>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
31+
| inside `_CONST_READ` at $DIR/out_of_bounds_read.rs:14:39
3032
|
3133
::: $DIR/out_of_bounds_read.rs:14:5
3234
|
@@ -37,15 +39,16 @@ LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() };
3739
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
3840

3941
error: any use of this value will cause an error
40-
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
41-
|
42-
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
43-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44-
| |
45-
| memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4
46-
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
47-
| inside `ptr::mut_ptr::<impl *mut u32>::read` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
48-
| inside `_MUT_READ` at $DIR/out_of_bounds_read.rs:15:37
42+
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL
43+
|
44+
LL | unsafe { copy_nonoverlapping(src, dst, count) }
45+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46+
| |
47+
| memory access failed: pointer must be in-bounds at offset 8, but is outside bounds of alloc6 which has size 4
48+
| inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL
49+
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
50+
| inside `ptr::mut_ptr::<impl *mut u32>::read` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
51+
| inside `_MUT_READ` at $DIR/out_of_bounds_read.rs:15:37
4952
|
5053
::: $DIR/out_of_bounds_read.rs:15:5
5154
|

0 commit comments

Comments
 (0)