ikatyang / tree-sitter-markdown

Markdown grammar for tree-sitter
https://ikatyang.github.io/tree-sitter-markdown
MIT License
183 stars 29 forks source link

parser still crashes and loops forever under fuzzing #32

Open dimbleby opened 3 years ago

dimbleby commented 3 years ago

Hi,

I thought I'd see how the parser did with the new TREE_SITTER_MARKDOWN_AVOID_CRASH trick against the fuzzer. Unfortunately, the fuzzer still finds crashes, and infinite loops.

Here are a couple of examples, I guess that there may be more.

[foo](*https://example.com
[foo](*https://example.com

result: parser loops and eats up all available memory.

[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[

result:

fatal runtime error: Rust cannot catch foreign exceptions
Aborted
m-novikov commented 3 years ago

According to the markdown spec

Implementations may impose limits on parentheses nesting to avoid performance issues, but at least three levels of nesting should be supported.