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

[release/7.0] Fix two auto-atomicity Regex bugs #74834

Merged
merged 3 commits into from
Aug 31, 2022

Commits on Aug 30, 2022

  1. Stop coalescing some adjacent Regex atomic loops

    We walk concatenations in order to combine adjacent loops, e.g. `a+a+a+` becomes `a{3,}`.  We also combine loops with individual items that are compatible, e.g. `a+ab` becomes `a{2,}b`. However, we're doing these operations on atomic loops as well, which is sometimes wrong. Since an atomic loop consumes as much as possible and never gives anything back, combining it with a subsequent loop will end up essentially ignoring any minimum specified in the latter loop. We thus can't combine atomic loops if the second loop has a minimum; this includes the case where the second "loop" is just an individual item.
    stephentoub authored and github-actions committed Aug 30, 2022
    Configuration menu
    Copy the full SHA
    29ef81f View commit details
    Browse the repository at this point in the history
  2. Fix auto-atomicity handling of \w and \b

    We currently consider \w and \b non-overlapping, which allows a \w loop followed by a \b to be made atomic.  The problem with this is that \b is zero-width, and it could be followed by something that does overlap with the \w. When matching at a location that is a word boundary, it is possible the first loop could give up something that matches the subsequent construct, and thus it can't be made atomic. (We could probably restrict this further to still allow atomicity when the first loop has a non-0 lower bound, but it doesn't appear to be worth the complication.)
    stephentoub authored and github-actions committed Aug 30, 2022
    Configuration menu
    Copy the full SHA
    4ee6e8a View commit details
    Browse the repository at this point in the history
  3. Add a few more tests

    stephentoub authored and github-actions committed Aug 30, 2022
    Configuration menu
    Copy the full SHA
    4368aee View commit details
    Browse the repository at this point in the history