tcort / markdown-link-extractor

extracts links from markdown texts
ISC License
23 stars 19 forks source link

RangeError: Maximum call stack size exceeded - for content with emojis #19

Closed rj-david closed 2 years ago

rj-david commented 2 years ago

Marked version: "marked": "^2.0.5"

Depended by this package: https://github.com/tcort/markdown-link-extractor

Describe the bug Getting an error for content with emojis: RangeError: Maximum call stack size exceeded

To Reproduce Steps to reproduce the behavior:

We are using the package markdown-link-extractor for the following sample content to extract links and the RangeError is thrown by marked

Hi, Patrick! šŸ‘‹
Did you hear that group activities like posting a discussion in a group can earn you 10x credits than the regular offer? Learn more about the special offers to look forward to this 10.10 Promo, from October 10 to 13 only!

Check the topic: **[šŸ“£ Promo Catalog & Many Ways to Earn Bigger Credits this 10.10 Promo!](https://1pt.ee/c/ea2c93)**

Stack trace

RangeError: Maximum call stack size exceeded\nPlease report this to https://github.com/markedjs/marked.\n    at String.match (<anonymous>)\n    at Tokenizer.link (/home/bountee/bundle/programs/server/npm/node_modules/markdown-link-extractor/index.js:14:31)\n    at Tokenizer.tokenizer.<computed> (/home/bountee/bundle/programs/server/npm/node_modules/marked/src/marked.js:165:45)\n    at Tokenizer.tokenizer.<computed> (/home/bountee/bundle/programs/server/npm/node_modules/marked/src/marked.js:167:31)\n    at Tokenizer.tokenizer.<computed> 

Expected behavior No error

Originally posted here: https://github.com/markedjs/marked/issues/2220

rj-david commented 2 years ago

Seems like this is an error with regex against the v8 engine when multiple processing happens at the same time

tcort commented 2 years ago

fixed in v3.0.0