Skip to content

Commit

Permalink
fix fuzz build
Browse files Browse the repository at this point in the history
  • Loading branch information
KillingSpark committed Mar 1, 2024
1 parent e49e5b7 commit b187691
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions rustbus/fuzz/fuzz_targets/fuzz_unmarshal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ extern crate libfuzzer_sys;
extern crate rustbus;

fuzz_target!(|data: &[u8]| {
let (hdrbytes, header) = match rustbus::wire::unmarshal::unmarshal_header(data, 0) {
let mut cursor = rustbus::wire::unmarshal_context::Cursor::new(data);
let header = match rustbus::wire::unmarshal::unmarshal_header(&mut cursor) {
Ok(head) => head,
Err(_) => return,
};
let dynheader = match rustbus::wire::unmarshal::unmarshal_dynamic_header(&header, &mut cursor) {
Ok(head) => head,
Err(_) => return,
};
let (dynhdrbytes, dynheader) =
match rustbus::wire::unmarshal::unmarshal_dynamic_header(&header, data, hdrbytes) {
Ok(head) => head,
Err(_) => return,
};

let (_bytes_used, msg) = match rustbus::wire::unmarshal::unmarshal_next_message(
let msg = match rustbus::wire::unmarshal::unmarshal_next_message(
&header,
dynheader,
data.to_vec(),
hdrbytes + dynhdrbytes,
cursor.consumed(),
) {
Ok(msg) => msg,
Err(_) => return,
Expand Down

0 comments on commit b187691

Please sign in to comment.