Skip to content

Commit

Permalink
fix: added a call limit setting to prevent crashes or timeouts
Browse files Browse the repository at this point in the history
closes #674, closes #675
  • Loading branch information
Tomas Tauber committed Aug 9, 2022
1 parent fa5f736 commit 70178ff
Show file tree
Hide file tree
Showing 8 changed files with 521 additions and 18 deletions.
2 changes: 2 additions & 0 deletions meta/fuzz/Cargo.toml
Expand Up @@ -8,6 +8,8 @@ rust-version = "1.56"
[package.metadata]
cargo-fuzz = true

[dependencies.pest]
path = "../../pest"
[dependencies.pest_meta]
path = ".."
[dependencies.libfuzzer-sys]
Expand Down
2 changes: 2 additions & 0 deletions meta/fuzz/fuzz_targets/parser.rs
Expand Up @@ -2,9 +2,11 @@
#[macro_use]
extern crate libfuzzer_sys;
extern crate pest_meta;
extern crate pest;

fuzz_target!(|data: &[u8]| {
if let Ok(s) = std::str::from_utf8(data) {
pest::set_call_limit(25_000, true);
let _ = pest_meta::parser::parse(pest_meta::parser::Rule::grammar_rules, s);
}
});
245 changes: 245 additions & 0 deletions meta/resources/test/fuzzsample1.grammar
@@ -0,0 +1,245 @@
w={
(((((((((((((((((((((((((((((((( (((((((((((((((((((((
((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((((((((
((((((((((((( ((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((
(((((
((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( ((((((((((((((((((((((((
((((((((((((( (((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((( ((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((((((
((( ((((((((((((((((((((((((
((((((((((((((((((((((((((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( ((((((((((((((((((((((((
((((((((((((( (((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((( ((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((((((
((( ((((((((((((((((((((((((
((((((((((((( ((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( ((((((((((((((((((((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((( ((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((
(((((
((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((
(((((
((((((((( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((((((((((((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((
(((((
((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( ((((((((((((((((((((((((
((((((((((((( (((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((( ((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((((((
((( ((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( (((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((
(((((
((((((((( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((((((((((((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( ((((((((((((((((((((((((
((((((((((((( (((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((( ((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((((((
((( ((((((((((((((((((((((((
((((((((((((( ((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( ((((((((((((((((((((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((( ((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((
(((((
((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( ((((((((((((((((((((((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((
(((((
((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( ((((((((((((((((((((((((
((((((((((((( (((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((( ((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((((((
((( ((((((((((((((((((((((((
((((((((((((((((((((((((((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( ((((((((((((((((((((((((
((((((((((((( (((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((( ((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((((((
((( ((((((((((((((((((((((((
((((((((((((( ((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( ((((((((((((((((((((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((( ((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((
(((((
((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((
(((((
((((((((( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((((((((((((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((
(((((
((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( ((((((((((((((((((((((((
((((((((((((( (((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((( ((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((((((
((( ((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( (((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((
(((((
((((((((( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((((((((((((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( ((((((((((((((((((((((((
((((((((((((( (((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((( ((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((((((
((( ((((((((((((((((((((((((
((((((((((((( ((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( ((((((((((((((((((((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((( ((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((
(((((
((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((
(((((
((((((((( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((((((((((((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( ((((((((((((((((((((((((
((((((((((((( (((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((( ((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((((((
((( ((((((((((((((((((((((((
((((((((((((( ((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( ((((((((((((((((((((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((( ((((((((((((((((((((((( (((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((
(((((
((((((((( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((((((((((((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( ((((((( ((((((((((((((((((((((((
((((((((((((( (((((((((((((((((
((((((((((((((((((((((((((((((//( (((((((((((((((((((((((((w={
(( (((((((((((((((((((((((((((((
(((((
((((((((((((((((((((((( (((((((((((((((((((((((((((((
(((((
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((( ((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((((((
((( ((((((((((((((((((((((((
((((((((((((( ((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((//( ((((((((((((((((((((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((( ((((((((((((((((((((((( (((((((((((((((((( ((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((( ((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((
6 changes: 6 additions & 0 deletions meta/resources/test/fuzzsample2.grammar
@@ -0,0 +1,6 @@

/*//j/*/*;'//*//*/*/*;'/*//*/*;**//*//*/*/*;'/*/ /*//*/*/*;+/*//*/*;*B/*//*/*/*/*;'/*//*/*;**//*//*/*/*;'/*/ /*//*/*/*;+/*//*/*;*B/*//*//*/*;**N//*//*/*/*;'/*//*//*/

*//*/*;**N//*//*/*/*;'/*//*//*/

*/*;+/*//**/*/*;'/*//*//*;*/*///*/*;

0 comments on commit 70178ff

Please sign in to comment.