-
-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quadratic behavior when parsing inlines #373
Comments
My tests:
Confirming, then, that output size is linear with N, time is quadratic. |
Interestingly, my Haskell commonmark library (which I had thought was implementing the same algorithm as cmark) is much faster for this case and has linear performance. |
For reference, the pattern in the input is:
(for N = 7) |
Puzzling. One would think this is due to nested list parsing, because if the pattern is changed by the addition of an |
The inline parsing code would call cmark_node_append_child to append nodes. This public function has a sanity check which is linear in the depth of the tree. Repeated calls could show quadratic behavior in degenerate trees. Use a special function to append nodes without this check. Fixes commonmark#373. Found by OSS-Fuzz.
This can also be triggered without
|
The inline parsing code would call cmark_node_append_child to append nodes. This public function has a sanity check which is linear in the depth of the tree. Repeated calls could show quadratic behavior in degenerate trees. Use a special function to append nodes without this check. Fixes #373. Found by OSS-Fuzz.
The inline parsing code would call cmark_node_append_child to append nodes. This public function has a sanity check which is linear in the depth of the tree. Repeated calls could show quadratic behavior in degenerate trees. Use a special function to append nodes without this check. Fixes commonmark#373. Found by OSS-Fuzz.
Found by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28805
Reduced test case:
The text was updated successfully, but these errors were encountered: