evilstreak / markdown-js

A Markdown parser for javascript
7.69k stars 863 forks source link

FIX: Performance black hole on sequential characters #158

Closed eviltrout closed 10 years ago

eviltrout commented 10 years ago

Using many [ characters in sequence sends markdown-js into a bad performance spiral, eventually pegging a core with CPU usage.

This fix prevents it from happening by counting how many levels of recursion there are in the link tag. We stop if there are more than 2 which is enough to handle all markdown tests, including mdtest in Discourse.

evilstreak commented 10 years ago

Thanks