xoofx / xoofx/markdig

Depth limit exceeded on non-malicious markdown content

Open
#504 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
5.3k
Forks
510
Avg merge
8d 5h
Merged PRs (30d)
5

Description

This file raises depth limit exceeded exception in version 0.23.0 due to #500.

Some additional info:

  • That file is an auto generated API reference page.
  • I cannot give a reasonable depth limit that don't break all content in docs.microsoft.com, but a depth limit configuration is a good start to mitigate the problem.
  • I did some perf profiling of markdig on a bunch of real markdown files used by docs.microsoft.com and the hottest function inside markdig is FindLastContainer. I don't have enough time to dig deeper, not sure if there are faster ways to find the last container (like tracking its location instead of search the tree each time?)

https://github.com/dotnet/docfx/pull/7016

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the depth-limit exception with the linked autogenerated markdown file, then inspect FindLastContainer and the changes from #500. Done means non-malicious documentation content no longer fails unexpectedly, with any depth-limit mitigation behaving as intended and its performance impact understood.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
performance, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.