Quadratic behavior in Commonmark renderer involving get_containing_block
nwellnhof opened this issue · 1 comments
nwellnhof commented
Found by OSS-Fuzz:
- https://oss-fuzz.com/testcase-detail/6306452753481728
- https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41619
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.