You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
def_list extension: uncaught RecursionError (DoS) on flat term/definition pairs #1700
The def_list extension raises an uncaught RecursionError on a flat document of term/definition pairs without blank lines between them:
importmarkdownmarkdown.markdown('term\n: definition\n'*600, extensions=['def_list'])
# RecursionError: maximum recursion depth exceeded
Each term\n: definition pair nests the remainder of the document one definition level deeper, so a document of only ~5 KB (linear in nesting depth) reaches the interpreter's recursion limit. DefListProcessor.run calls parseBlocks on the definition content, which contains the remaining pairs, and DefListProcessor.test has no recursion-limit guard.
Blockquotes are already guarded against this (BlockquoteProcessor.test checks util.nearing_recursion_limit()), and #1679 tracks the same class for lists (PR #1685). Definition lists are the remaining unguarded recursion.
Expected behavior
Nesting stops short of the recursion limit, keeping the remaining markers as text, the same way blockquotes and lists behave.
Activity
Stop definition list nesting short of the recursion limit