
* Fixes to main * Add librasan * Party like it's 2024 * Fix snapshot module to work with guest asan * Fix guest_asan module * Fixes to runner * Fix linking issues using a REL * Fix qemu_launcher * Change modify_mapping to a method * Fix gasan_test * Remove debug from Justfile * Optimize release build of librasan * Set ulimit for qasan and gasan tests * Tidy up symbol renaming * Add missing symbols for PPC * Change to support rustix 1.0.0 * Canonicalize the CUSTOM_ASAN_PATH * Review changes * Restructure backends * release_max_level_info * More review changes * Clippy fixes * Changes to reduce the burden on the CI * Fix macos clippy --------- Co-authored-by: Your Name <you@example.com>
36 lines
727 B
Rust
36 lines
727 B
Rust
#[cfg(test)]
|
|
#[cfg(all(feature = "hooks", feature = "libc"))]
|
|
mod tests {
|
|
use core::{
|
|
ffi::{c_char, c_int},
|
|
ptr::null_mut,
|
|
};
|
|
|
|
use asan::{expect_panic, hooks::fgets::fgets};
|
|
use libc::FILE;
|
|
|
|
#[test]
|
|
fn test_read_null_stream() {
|
|
let mut buf = [0u8; 10];
|
|
expect_panic();
|
|
|
|
unsafe {
|
|
fgets(
|
|
buf.as_mut_ptr() as *mut c_char,
|
|
buf.len() as c_int,
|
|
null_mut(),
|
|
)
|
|
};
|
|
unreachable!();
|
|
}
|
|
|
|
#[test]
|
|
fn test_read_null_buff() {
|
|
let stream = 0xdeadface as *mut FILE;
|
|
expect_panic();
|
|
|
|
unsafe { fgets(null_mut(), 10, stream) };
|
|
unreachable!();
|
|
}
|
|
}
|