about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail-dep/libc/prctl-get-name-buffer-too-small.rs
blob: 4b731866aca1d62824e5560c00ef58480037c547 (plain)
1
2
3
4
5
6
7
8
9
10
//! Ensure we report UB when the buffer is smaller than 16 bytes (even if the thread
//! name would fit in the smaller buffer).
//@only-target: android  # Miri supports prctl for Android only

fn main() {
    let mut buf = vec![0u8; 15];
    unsafe {
        libc::prctl(libc::PR_GET_NAME, buf.as_mut_ptr().cast::<libc::c_char>()); //~ ERROR: memory access failed: expected a pointer to 16 bytes of memory, but got alloc952 which is only 15 bytes from the end of the allocation
    }
}