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

Updated refa + fixed 2 cases of exponential backtracking #2774

merged 2 commits into from Mar 5, 2021


Copy link

I worked on refa over the last couple of days and added 2 major improvements:

  1. The parser will now resolve certain backreferences. E.g. /("|')(?:(?!\1)[^\\\r\n]|\\.)*\1/ will be parsed as /"(?:(?!")[^\\\r\n]|\\.)*"|'(?:(?!')[^\\\r\n]|\\.)*'/.
  2. Assertions can be applied to the pattern. E.g. /"(?:(?!")[^\\\r\n]|\\.)*"/ -> /"(?:[^"\\\r\n]|\\.)*"/.

These two additions enable our current exponential backtracking test to analyze a few more regexes. And guess what, it found new cases of exponential backtracking. The AsciiDoc ones are true positives and have been fixed. The Perl one is a false positive but I "fixed" it anyway.

Copy link

github-actions bot commented Feb 25, 2021

JS File Size Changes (gzipped)

A total of 2 files have changed, with a combined diff of +1 B (+0.0%).

file master pull size diff % diff
components/prism-asciidoc.min.js 1.62 KB 1.62 KB -2 B -0.1%
components/prism-perl.min.js 999 B 1 KB +3 B +0.3%

Generated by 🚫 dangerJS against 97e27e5

Copy link
Member Author

I'll merge this now cause it's kinda important.

@RunDevelopment RunDevelopment merged commit d85e30d into PrismJS:master Mar 5, 2021
@RunDevelopment RunDevelopment deleted the refa-v0.7.0-update branch March 5, 2021 15:38
Copy link
Member Author

Should there still be anything that requires changes, please comment on this PR (or the merge commit) and I'll make the requested changes in a separate PR.

This was referenced Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

1 participant