Files
MercuryToolbox/fuzz/fuzz_targets/json_family_decode.rs
T

24 lines
701 B
Rust

#![no_main]
use common::formats::toon::DecodeOptions;
use common::formats::{ison, tonl, toon, zon};
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &[u8]| {
let Ok(input) = std::str::from_utf8(data) else {
return;
};
let _ = toon::decode_str(input, DecodeOptions::default());
let _ = ison::decode_record_line(input, 1);
let _ = ison::decode_records(input);
let _ = zon::decode_str(input);
let _ = tonl::decode_documents(input);
if let Ok(value) = serde_json::from_str::<serde_json::Value>(input) {
let _ = toon::encode_value_default(&value);
let _ = zon::encode_value(&value);
let _ = tonl::encode_documents(&[value]);
}
});