forked from AbleOS/holey-bytes
30 lines
556 B
Rust
30 lines
556 B
Rust
|
#![no_main]
|
||
|
|
||
|
use {
|
||
|
hbvm::vm::{
|
||
|
mem::{HandlePageFault, Memory, MemoryAccessReason, PageSize},
|
||
|
Vm,
|
||
|
},
|
||
|
libfuzzer_sys::fuzz_target,
|
||
|
};
|
||
|
|
||
|
fuzz_target!(|data: &[u8]| {
|
||
|
if let Ok(mut vm) = Vm::<_, 0>::new_validated(data, TestTrapHandler) {
|
||
|
let _ = vm.run();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
struct TestTrapHandler;
|
||
|
impl HandlePageFault for TestTrapHandler {
|
||
|
fn page_fault(
|
||
|
&mut self,
|
||
|
_: MemoryAccessReason,
|
||
|
_: &mut Memory,
|
||
|
_: u64,
|
||
|
_: PageSize,
|
||
|
_: *mut u8,
|
||
|
) -> bool {
|
||
|
false
|
||
|
}
|
||
|
}
|