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

RegexSet: fix literal optimization bug #370

Merged
merged 1 commit into from
May 20, 2017
Merged

Conversation

BurntSushi
Copy link
Member

When combining multiple regexes in a set where some are anchored and
others aren't, it's possible to wind up in a situation where prefix
scanning is used. This is bad, because it can lead to some of the
anchored regexes matching where they shouldn't be allowed to match.
As a result, we disable all literal optimizations for regex sets if
any regex in the set is anchored.

Fixes #358

When combining multiple regexes in a set where some are anchored and
others aren't, it's possible to wind up in a situation where prefix
scanning is used. This is bad, because it can lead to some of the
anchored regexes matching where they shouldn't be allowed to match.
As a result, we disable all literal optimizations for regex sets if
*any* regex in the set is anchored.

Fixes rust-lang#358
@BurntSushi
Copy link
Member Author

@bors r+

@bors
Copy link
Contributor

bors commented May 20, 2017

📌 Commit be9653c has been approved by BurntSushi

@bors
Copy link
Contributor

bors commented May 20, 2017

⌛ Testing commit be9653c with merge bedc221...

bors added a commit that referenced this pull request May 20, 2017
RegexSet: fix literal optimization bug

When combining multiple regexes in a set where some are anchored and
others aren't, it's possible to wind up in a situation where prefix
scanning is used. This is bad, because it can lead to some of the
anchored regexes matching where they shouldn't be allowed to match.
As a result, we disable all literal optimizations for regex sets if
*any* regex in the set is anchored.

Fixes #358
@bors
Copy link
Contributor

bors commented May 20, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: BurntSushi
Pushing bedc221 to master...

@bors bors merged commit be9653c into rust-lang:master May 20, 2017
@BurntSushi BurntSushi deleted the ag-fix-358 branch July 19, 2021 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RegexSet doesn't respect the ^ anchor
2 participants