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

Resolve issue with catastrophic backtracking regex #436

Merged
merged 1 commit into from
Feb 2, 2023

Conversation

Prestaul
Copy link
Contributor

@Prestaul Prestaul commented Apr 27, 2022

Catastrophic backtracking in the BREAK_THEMATIC_R regex causes parsing to hang on non-matching input with repeating asterisks like this:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SOME TEXT
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

or even just:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

This minor regex change resolves that issue without changing the matched pattern or capture group.

Catastrophic backtracking in the `BREAK_THEMATIC_R` regex causes parsing to hang on non-matching input with repeating asterisks like this:
```
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SOME TEXT
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
```
or even just:
```
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
```
This minor regex change resolves that issue without changing the matched pattern or capture group.
Copy link
Owner

@quantizor quantizor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good thanks!

@quantizor quantizor merged commit cb1dee5 into quantizor:main Feb 2, 2023
Innei pushed a commit to Innei/markdown-to-jsx that referenced this pull request Aug 2, 2023
Catastrophic backtracking in the `BREAK_THEMATIC_R` regex causes parsing to hang on non-matching input with repeating asterisks like this:
```
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SOME TEXT
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
```
or even just:
```
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
```
This minor regex change resolves that issue without changing the matched pattern or capture group.
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.

None yet

2 participants