Skip to content

Commit aa23703

Browse files
committed
1 parent 6ec0a00 commit aa23703

4 files changed

+43
-0
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.

regex-syntax/src/hir/translate.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3703,4 +3703,47 @@ mod tests {
37033703
let mut t = Translator::new();
37043704
assert_eq!(Ok(Hir::dot(Dot::AnyCharExceptLF)), t.translate("", &ast));
37053705
}
3706+
3707+
// See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63168
3708+
#[test]
3709+
fn regression_fuzz_match() {
3710+
let pat = "[(\u{6} \0-\u{afdf5}] \0 ";
3711+
let ast = ParserBuilder::new()
3712+
.octal(false)
3713+
.ignore_whitespace(true)
3714+
.build()
3715+
.parse(pat)
3716+
.unwrap();
3717+
let hir = TranslatorBuilder::new()
3718+
.utf8(true)
3719+
.case_insensitive(false)
3720+
.multi_line(false)
3721+
.dot_matches_new_line(false)
3722+
.swap_greed(true)
3723+
.unicode(true)
3724+
.build()
3725+
.translate(pat, &ast)
3726+
.unwrap();
3727+
assert_eq!(
3728+
hir,
3729+
Hir::concat(vec![
3730+
hir_uclass(&[('\0', '\u{afdf5}')]),
3731+
hir_lit("\0"),
3732+
])
3733+
);
3734+
}
3735+
3736+
// See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63155
3737+
#[test]
3738+
fn regression_fuzz_difference1() {
3739+
let pat = r"\W\W|\W[^\v--\W\W\P{Script_Extensions:Pau_Cin_Hau}\u10A1A1-\U{3E3E3}--~~~~--~~~~~~~~------~~~~~~--~~~~~~]*";
3740+
let _ = t(pat); // shouldn't panic
3741+
}
3742+
3743+
// See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63153
3744+
#[test]
3745+
fn regression_fuzz_char_decrement1() {
3746+
let pat = "w[w[^w?\rw\rw[^w?\rw[^w?\rw[^w?\rw[^w?\rw[^w?\rw[^w?\r\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0w?\rw[^w?\rw[^w?\rw[^w\0\0\u{1}\0]\0\0-*\0]\0\0\0\0\0\0\u{1}\0]\0\0-*\0]\0\0\0\0\0\u{1}\0]\0\0\0\0\0\0\0\0\0*\0\0\u{1}\0]\0\0-*\0][^w?\rw[^w?\rw[^w?\rw[^w?\rw[^w?\rw[^w?\rw[^w\0\0\u{1}\0]\0\0-*\0]\0\0\0\0\0\0\u{1}\0]\0\0-*\0]\0\0\0\0\0\u{1}\0]\0\0\0\0\0\0\0\0\0x\0\0\u{1}\0]\0\0-*\0]\0\0\0\0\0\0\0\0\0*??\0\u{7f}{2}\u{10}??\0\0\0\0\0\0\0\0\0\u{3}\0\0\0}\0-*\0]\0\0\0\0\0\0\u{1}\0]\0\0-*\0]\0\0\0\0\0\0\u{1}\0]\0\0-*\0]\0\0\0\0\0\u{1}\0]\0\0-*\0]\0\0\0\0\0\0\0\u{1}\0]\0\u{1}\u{1}H-i]-]\0\0\0\0\u{1}\0]\0\0\0\u{1}\0]\0\0-*\0\0\0\0\u{1}9-\u{7f}]\0'|-\u{7f}]\0'|(?i-ux)[-\u{7f}]\0'\u{3}\0\0\0}\0-*\0]<D\0\0\0\0\0\0\u{1}]\0\0\0\0]\0\0-*\0]\0\0 ";
3747+
let _ = t(pat); // shouldn't panic
3748+
}
37063749
}

0 commit comments

Comments
 (0)