-
Notifications
You must be signed in to change notification settings - Fork 156
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
Parsing ‘a***a***a***a***…’ takes quadratic time #63
Comments
@jgm Maybe you can thank me for commonmark/cmark#284 by explaining how is it possible that Cmark is not vulnerable to this issue? ;-) MD4C walks the dangling openers for each |
@mity in cmark we keep a list of "lower bounds" for openers that might match each possible type of closer (e.g., asterisk span with length mod 3 == 0). So once we've rejected one opening span as a possible opener for a closer consisting of 3 asterisks, we won't need to look at it again. Code is around here. |
@jgm I will have to do it a bit differently due to some internal limitations. But it helped a lot, thanks. |
@andersk Fixed it all, finally. Thank you for the bug hunt. I will eventually release 0.3.1 with all those fixes after some afl-fuzzing session. That is, unless you have something more queued for me? ;-) |
We had to break the list of potential '*' openers into multiple ones so we do not have to walk it when looking for matching length due to the "rule of three" for intraword delimiter runs. Fixes mity#63.
The text was updated successfully, but these errors were encountered: