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

Fix catastrophic backtracking? #535

Merged
merged 1 commit into from Sep 21, 2017

Conversation

Projects
None yet
2 participants
@50Wliu
Member

50Wliu commented Sep 21, 2017

@Alhadis please review and tell me there's a better solution than this

Fixes #533

@@ -276,11 +276,11 @@
\\s*
(
# The inner regexes are to stop the match early at */ and to not stop at escaped quotes
(?:
(?>

This comment has been minimized.

@Alhadis

Alhadis Sep 21, 2017

Contributor

I've tested this locally, and it works. 👍

However, there's no hairy backtracking being performed here, so it's quite strange this is happening...

@Alhadis

Alhadis Sep 21, 2017

Contributor

I've tested this locally, and it works. 👍

However, there's no hairy backtracking being performed here, so it's quite strange this is happening...

This comment has been minimized.

@50Wliu

50Wliu Sep 21, 2017

Member

You can play around with the regex debugger at https://regex101.com/r/miqTHE/1 if you want. The * here and the * on the everything else line can catastrophically backtrack when there's no ] or */ present.

@50Wliu

50Wliu Sep 21, 2017

Member

You can play around with the regex debugger at https://regex101.com/r/miqTHE/1 if you want. The * here and the * on the everything else line can catastrophically backtrack when there's no ] or */ present.

@Alhadis

This comment has been minimized.

Show comment
Hide comment
@Alhadis

Alhadis Sep 21, 2017

Contributor

Only alternative solution I could suggest involves capturing everything up until either $ or (?=\*/), and defining patterns to be used within the capture.

Probably too complex FWIW, really.

Contributor

Alhadis commented Sep 21, 2017

Only alternative solution I could suggest involves capturing everything up until either $ or (?=\*/), and defining patterns to be used within the capture.

Probably too complex FWIW, really.

@50Wliu 50Wliu merged commit 9c4c0e3 into master Sep 21, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@50Wliu 50Wliu deleted the wl-bad-jsdoc branch Sep 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment