Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic in regex_syntax, found by fuzzing #527

Closed
PaulGrandperrin opened this issue Oct 15, 2018 · 1 comment
Closed

Panic in regex_syntax, found by fuzzing #527

PaulGrandperrin opened this issue Oct 15, 2018 · 1 comment
Labels

Comments

@PaulGrandperrin
Copy link

While fuzzing the regex_syntax target from https://github.com/rust-fuzz/targets, I hit this panic:

thread 'main' panicked at 'tried to unwrap expr from HirFrame, got: Group { old_flags: None }', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-syntax-0.6.2/src/hir/translate.rs:203:18

Here is the regex:

regex::Regex::new("(((?x)))");

playground

@BurntSushi
Copy link
Member

Nice! It looks like ((?x)) also panics. (?:(?x)) does as well. As does ((?x))x.

@BurntSushi BurntSushi added the bug label Oct 15, 2018
BurntSushi added a commit that referenced this issue Mar 30, 2019
This fixes yet another bug with our handling of (?flags) directives in
the regex. This time, we try to be a bit more principled and
specifically treat a (?flags) directive as a valid empty sub-expression.
While this means we could remove errors reported from previous fixes for
things like `(?i)+`, we retain those for now since they are a bit weird.
Although `((?i))+` is now allowed, which is equivalent. We should
probably allow `(?i)+` in the future for consistency sake.

Fixes #527
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants