Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 040c064

Browse files
committedApr 27, 2018
Add regex syntax target
Run it with `cargo run target regex_syntax` Finds the following inputs that yield panics, some of which are also mentioned in [1]: - `b"(?m)?"`� - `b"(?i)?i\x0e"` - `b"CBh~62\x17Y((?i))??i\x0e"`� - `b"(?m)?90"` - `b"(?i)?"` [1]: rust-lang/regex#465
1 parent 7987f0f commit 040c064

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed
 

‎common/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ proc-macro2 = { git = "https://github.com/alexcrichton/proc-macro2.git" }
3131
pulldown-cmark = { git = "https://github.com/google/pulldown-cmark.git" }
3232
quick-xml = { git = "https://github.com/tafia/quick-xml" }
3333
regex = { git = "https://github.com/rust-lang-nursery/regex" }
34+
regex-syntax = { git = "https://github.com/rust-lang-nursery/regex" }
3435
ring = { git = "https://github.com/briansmith/ring" }
3536
semver = { git = "https://github.com/steveklabnik/semver" }
3637
serde_json = { git = "https://github.com/serde-rs/json", features = ["arbitrary_precision"] }

‎common/src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ extern crate proc_macro2;
2525
extern crate pulldown_cmark;
2626
extern crate quick_xml;
2727
extern crate regex;
28+
extern crate regex_syntax;
2829
extern crate ring;
2930
extern crate semver;
3031
extern crate serde_json;
@@ -475,6 +476,13 @@ pub fn fuzz_quick_xml_read(data: &[u8]) {
475476
}
476477
}
477478

479+
#[inline(always)]
480+
pub fn fuzz_regex_syntax(data: &[u8]) {
481+
if let Ok(data) = std::str::from_utf8(data) {
482+
let _ = regex_syntax::Parser::new().parse(data);
483+
}
484+
}
485+
478486
#[inline(always)]
479487
pub fn fuzz_regex_is_match(data: &[u8]) {
480488
if let Ok(data) = std::str::from_utf8(data) {

0 commit comments

Comments
 (0)
Please sign in to comment.