summaryrefslogtreecommitdiff
path: root/fuzz/fuzz_targets/no-panic.rs
blob: d2653dd09d56a18ca48359255e65a413b4a127f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#![no_main]
use libfuzzer_sys::fuzz_target;

use yaxpeax_arch::Decoder;

use std::fmt::Write;

fuzz_target!(|data: &[u8]| {
    let decoder = yaxpeax_hexagon::InstDecoder::default();

    let mut hexagon_inst = yaxpeax_hexagon::InstructionPacket::default();

    let mut words = yaxpeax_arch::U8Reader::new(data);

    // whatever the output, we should be able to format the instruction that was decoded into
    let _ = decoder.decode_into(&mut hexagon_inst, &mut words);
    write!(&mut String::new(), "{}", hexagon_inst).expect("formatting does not panic either");
});