crosvm/fuzz/fuzzers/fuzz_zimage.rs
David Tolnay fc7427eb2b fmt: Format sys_util and fuzz crates using rustfmt
These are each their own workspace so I guess `cargo fmt` at the top
level of the repo does not hit them.

I checked that none of the other workspace roots currently need to be
reformatted.

TEST=cargo check

Change-Id: I734cbc0f909fd3c2138513d9539b917bce80c0a8
Reviewed-on: https://chromium-review.googlesource.com/1477496
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2019-02-21 06:29:42 -08:00

17 lines
452 B
Rust

#![no_main]
#[macro_use]
extern crate libfuzzer_sys;
extern crate kernel_loader;
extern crate libc;
extern crate sys_util;
use sys_util::{GuestAddress, GuestMemory};
use std::io::Cursor;
fuzz_target!(|data: &[u8]| {
// fuzzed code goes here
let mut kimage = Cursor::new(data);
let mem = GuestMemory::new(&[(GuestAddress(0), data.len() + 0x1000)]).unwrap();
let _ = kernel_loader::load_kernel(&mem, GuestAddress(0), &mut kimage);
});