Skip to content
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

Pathological input: Unclosed inline links #214

Closed
mity opened this issue Jul 11, 2017 · 2 comments
Closed

Pathological input: Unclosed inline links #214

mity opened this issue Jul 11, 2017 · 2 comments

Comments

@mity
Copy link
Contributor

mity commented Jul 11, 2017

The following command generates Markdown input which takes inadequately long time with current Cmark's master head (88c8ad1). (On my Windows machine it takes 13.076 seconds.)

$ python -c 'print("[a](b" * 50000)'

Seems to be regression, Cmark 0.27.1 processes it fine (0.063 s)

@mity
Copy link
Contributor Author

mity commented Jul 11, 2017

The commit a9da678 is responsible for the regression.

mity added a commit to mity/md4c that referenced this issue Jul 12, 2017
The permission of nesting (balanced) parenthesis pairs in the link
destination opened doors to quadratic time with malicious input like e.g.
generated by

   $ python -c 'print("[a](b" * 50000)'

See commonmark/cmark#214 for more info.

We solve it by limiting the parenthesis nesting level to 32.
@jgm
Copy link
Member

jgm commented Jul 13, 2017

Anything that fixes this should also add this case to the pathological tests in the test suite.

@mity mity changed the title Pathological input Pathological input: Link destination with parenthesis Jul 25, 2017
@mity mity changed the title Pathological input: Link destination with parenthesis Pathological input: Unclosed inline links Jul 25, 2017
@jgm jgm closed this as completed in #217 Nov 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants