commonmark/cmark

Quadratic behavior in Commonmark renderer involving get_containing_block

nwellnhof opened this issue · 1 comments

Found by OSS-Fuzz:

I haven't investigated the test case form OSS-Fuzz, but the stack trace contains the function get_containing_block in the Commonmark renderer which can obviously lead to quadratic behavior with deeply nested inlines:

python3 -c 'print("*"*100000+"a"+"*"*100000)' |build/src/cmark -t commonmark |wc -c
jgm commented

Your fix seems excellent -- go ahead and submit a PR.