Files
marked/test
Tzong Hao Chen 46fb9b806f fix: prevent ReDoS in inline link regex title group (#3902)
The title separator in the link regex used [ \t]* which allowed the
title group to be probed at every backtrack position of the greedy href
group. On long single-line input containing [text]( patterns without a
nearby closing ), this produced O(n²) per regex call and O(n³) in the
full inline tokenizer.

Change [ \t]* to [ \t]+|\n to require actual whitespace before the
title. This matches CommonMark spec requirements and eliminates the
backtracking cascade.

Before: 18K input takes ~36 seconds (event loop blocked)
After:  18K input takes ~45ms
2026-03-04 08:30:23 -07:00
..