Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

def_list extension: uncaught RecursionError (DoS) on flat term/definition pairs #1700

Closed

Description

@rahul05ranjan

Describe the bug

The def_list extension raises an uncaught RecursionError on a flat document of term/definition pairs without blank lines between them:

import markdown
markdown.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.

To Reproduce

  1. markdown.markdown('term\n: definition\n' * 600, extensions=['def_list'])
  2. Observe RecursionError: maximum recursion depth exceeded

Activity

  1. added a commit that references this issue on Nov 10, 2026
    26e43de
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions