Closed andersk closed 5 years ago
@jgm Maybe you can thank me for https://github.com/commonmark/cmark/issues/284 by explaining how is it possible that Cmark is not vulnerable to this issue? ;-)
MD4C walks the dangling openers for each ***
but all of them fail because of the rule of three. So after it all fails, it is added as just another dangling opener, and then we do it all again for next ***
.
@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? ;-)