#json #fuzzer #arbitrary

bin+lib arbitrary-json

A Json generator based on serde_json and arbitrary

2 releases

0.1.1 Feb 23, 2022
0.1.0 Jan 13, 2022

#1272 in Development tools

Download history 153/week @ 2024-01-22 100/week @ 2024-01-29 167/week @ 2024-02-05 151/week @ 2024-02-12 1112/week @ 2024-02-19 373/week @ 2024-02-26 14/week @ 2024-03-04

1,679 downloads per month
Used in streaming-json-completer

WTFPL license

7KB
97 lines

Arbitrary JSON

This crate provide a compatibility layer between serde_json and arbitrary. This allow you to generate random valid json when fuzzing your rust code. See the following example:

#![no_main]
use arbitrary_json::ArbitraryValue;
use libfuzzer_sys::fuzz_target;

fuzz_target!(|data: ArbitraryValue| {
    // call your very complex code here
    if data["truc"] == serde_json::json!(42) {
        panic!("Found the magic value");
    }
});

lib.rs:

Arbitrary JSON

This crate provide a compatibility layer between serde_json and arbitrary. This allow you to generate random valid json when fuzzing your rust code. See the following example:

#![no_main]
use arbitrary_json::ArbitraryValue;
use libfuzzer_sys::fuzz_target;

fuzz_target!(|data: ArbitraryValue| {
    // call your very complex code here
    if data["truc"] == serde_json::json!(42) {
        panic!("Found the magic value");
    }
});

Dependencies

~0.5–0.9MB
~19K SLoC