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

Fix quadratic performance issue in list numbering #473

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kevinbackhouse
Copy link

This is the same fix as github#322. It fixes the bug described in GHSA-r8vr-c48j-fcc5.

To reproduce the bug:

python3 -c 'n = 10000; print("1.\n" + " 2.\n"*n)' | time ./src/cmark -t commonmark
python3 -c 'n = 10000; print("1.\n" + " 2.\n"*n)' | time ./src/cmark -t man

Increasing the number 10000 in the above command causes the running time to increase quadratically.

This PR replaces #472, which didn't work correctly (see github#321).

@jgm
Copy link
Member

jgm commented Apr 2, 2023

Thanks for submitting this! I haven't had a chance to look at it in detail yet.

src/cmark.h Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

3 participants