This commit is contained in:
Ralf Jung 2022-07-07 20:12:30 -04:00
parent 622963a2df
commit 23d1f1a5a3
4 changed files with 7 additions and 7 deletions

View File

@ -1 +1 @@
8824d131619e58a38bde8bcf56401629b91a204a
1517f5de01c445b5124b30f02257b02b4c5ef3b2

View File

@ -291,8 +291,8 @@ pub fn report_error<'tcx, 'mir>(
match e.kind() {
UndefinedBehavior(UndefinedBehaviorInfo::InvalidUninitBytes(Some((alloc_id, access)))) => {
eprintln!(
"Uninitialized read occurred at {alloc_id:?}{range:?}, in this allocation:",
range = alloc_range(access.uninit_offset, access.uninit_size),
"Uninitialized memory occurred at {alloc_id:?}{range:?}, in this allocation:",
range = access.uninit,
);
eprintln!("{:?}", ecx.dump_alloc(*alloc_id));
}

View File

@ -1,4 +1,4 @@
// error-pattern: 12 bytes are uninitialized
// error-pattern: memory is uninitialized at [0x4..0x10]
use std::alloc::{alloc, dealloc, Layout};
use std::slice::from_raw_parts;

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: reading 16 bytes of memory starting at ALLOC, but 12 bytes are uninitialized starting at ALLOC+0x4, and this operation requires initialized memory
error: Undefined Behavior: reading memory at ALLOC[0x0..0x10], but memory is uninitialized at [0x4..0x10], and this operation requires initialized memory
--> RUSTLIB/core/src/slice/cmp.rs:LL:CC
|
LL | let mut order = unsafe { memcmp(left.as_ptr(), right.as_ptr(), len) as isize };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading 16 bytes of memory starting at ALLOC, but 12 bytes are uninitialized starting at ALLOC+0x4, and this operation requires initialized memory
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reading memory at ALLOC[0x0..0x10], but memory is uninitialized at [0x4..0x10], and this operation requires initialized memory
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
@ -17,7 +17,7 @@ LL | drop(slice1.cmp(slice2));
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
Uninitialized read occurred at ALLOC[0x4..0x10], in this allocation:
Uninitialized memory occurred at ALLOC[0x4..0x10], in this allocation:
ALLOC (Rust heap, size: 32, align: 8) {
0x00 │ 41 42 43 44 __ __ __ __ __ __ __ __ __ __ __ __ │ ABCD░░░░░░░░░░░░
0x10 │ 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ │ .░░░░░░░░░░░░░░░