StackOverflowException is throw when converting special markdown to HTML #418

Closed
opened 2026-01-29 14:36:12 +00:00 by claunia · 6 comments
Owner

Originally created by @leonyang12 on GitHub (Dec 7, 2020).

We use Markdig in our code to convert Markdown to HTML. It works perfect in most cases w.r.t. to performance. Recently we received reports that the library hangs and throws StackOverflowException when processing some special markdowns.

Here are the sample code:
`string input = ;
var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();

string result = Markdown.ToHtml(input, pipeline);`

@xoofx, I wouldn't paste the markdown payload here due to security reason, please let me know the best option to share it out to continue investigation.

Originally created by @leonyang12 on GitHub (Dec 7, 2020). We use Markdig in our code to convert Markdown to HTML. It works perfect in most cases w.r.t. to performance. Recently we received reports that the library hangs and throws StackOverflowException when processing some special markdowns. Here are the sample code: `string input = <special markdown input>; var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); string result = Markdown.ToHtml(input, pipeline);` @xoofx, I wouldn't paste the markdown payload here due to security reason, please let me know the best option to share it out to continue investigation.
claunia added the bug label 2026-01-29 14:36:12 +00:00
Author
Owner

@xoofx commented on GitHub (Dec 8, 2020):

Could you compile a local version of Markdig, debug it with your markdown and try to extract a smaller repro that you could post?

@xoofx commented on GitHub (Dec 8, 2020): Could you compile a local version of Markdig, debug it with your markdown and try to extract a smaller repro that you could post?
Author
Owner

@MihaZupan commented on GitHub (Dec 8, 2020):

Feel free to share the input via any contact on my profile.

@MihaZupan commented on GitHub (Dec 8, 2020): Feel free to share the input via any contact on my profile.
Author
Owner

@leonyang12 commented on GitHub (Dec 8, 2020):

@xoofx , thanks for the quick response. I reached out to @MihaZupan and shared the markdown input with repro.

@leonyang12 commented on GitHub (Dec 8, 2020): @xoofx , thanks for the quick response. I reached out to @MihaZupan and shared the markdown input with repro.
Author
Owner

@leonyang12 commented on GitHub (Dec 10, 2020):

@MihaZupan , has there been any update with investigation?

@leonyang12 commented on GitHub (Dec 10, 2020): @MihaZupan , has there been any update with investigation?
Author
Owner

@leonyang12 commented on GitHub (Jan 13, 2021):

@xoofx , will you be able to review @MihaZupan 's fix? Thanks

@leonyang12 commented on GitHub (Jan 13, 2021): @xoofx , will you be able to review @MihaZupan 's fix? Thanks
Author
Owner

@leonyang12 commented on GitHub (Jan 15, 2021):

@xoofx, when can we expect a new version with the fix?

@leonyang12 commented on GitHub (Jan 15, 2021): @xoofx, when can we expect a new version with the fix?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#418