Skip to content

Commit

Permalink
fix: put a call limit on the json fuzzer (#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtau committed Aug 16, 2022
1 parent 0640862 commit abb1972
Show file tree
Hide file tree
Showing 4 changed files with 5,644 additions and 2 deletions.
4 changes: 4 additions & 0 deletions grammars/fuzz/fuzz_targets/json.rs
@@ -1,13 +1,17 @@
#![no_main]
#[macro_use]
extern crate libfuzzer_sys;
extern crate pest;
extern crate pest_grammars;

use std::convert::TryInto;

fuzz_target!(|data: &[u8]| {
use pest_grammars::json;
use pest_grammars::Parser;

if let Ok(s) = std::str::from_utf8(data) {
pest::set_call_limit(Some(45_000usize.try_into().unwrap()));
let _ = json::JsonParser::parse(json::Rule::json, s);
}
});

0 comments on commit abb1972

Please sign in to comment.