| Crates.io | accessible |
| lib.rs | accessible |
| version | 0.1.1 |
| created_at | 2025-09-26 03:29:56.790023+00 |
| updated_at | 2025-09-26 06:28:42.309563+00 |
| description | Non-trapping memory readability probes for FFI sanity checks |
| homepage | https://github.com/gzz2000/accessible-rs |
| repository | https://github.com/gzz2000/accessible-rs |
| max_upload_size | |
| id | 1855382 |
| size | 37,375 |
accessible offers best-effort, non-trapping memory readability probes for Rust FFI boundaries. It
is intended as a diagnostic aid so C-callable shims can flag obviously bad pointers before diving
into more expensive work.
Add the crate and call the helpers from an extern "C" entry point (status codes omitted for
brevity):
use accessible::{probe_readable_range, CheckError};
#[no_mangle]
pub unsafe extern "C" fn consume_buffer(ptr: *const u8, len: usize) {
if let Err(CheckError::Unreadable(err)) = probe_readable_range(ptr, len) {
eprintln!("input buffer was unreadable: {err}");
return;
}
// Safe-ish to continue: the first and last byte were readable at the time of the probe.
}
Additional helpers exist for probing single values (probe_readable_value) and slices
(probe_readable_slice).
| Platform | Implementation |
|---|---|
| Linux | process_vm_readv with /proc/self/mem fallback |
| macOS | mach_vm_read_overwrite |
| Windows | ReadProcessMemory |
| Others | Returns CheckError::Unsupported |
probe_readable repeatedly./proc/self/mem will be reported as
unreadable.cargo fmt
cargo test
CI is configured to run the test suite on Linux, macOS, and Windows so regressions surface quickly on the major platforms.