Skip to content

Groups of consecutive underscores in a specific pattern hang/take a long time to convert #1927

@Xegyn

Description

@Xegyn

Marked version: 1.2.9

Describe the bug
3 or more groups of odd and even-numbered consecutive underscores followed by a character takes a very long time to convert.
Example input: _______________________________ ____________________ __________________________ a
If you click on the Marked Demo link below, you will see that this takes a long time to convert (approximately 2 minutes).
The input above is:
31 underscores, 20 underscores, 26 underscores, and an a.

Modifying the input in a number of ways changes the conversion time to < 10ms:

  • modifying the above input so that the 1st group of underscores is an even number
  • modifying the 2nd or 3rd group of underscores to be an odd number
  • removing the trailing a character.

It seems that the longer the consecutive underscores are in length, the time increasingly gets longer.

To Reproduce
Steps to reproduce the behavior:

  1. Marked Demo
  2. CommonMark Demo

Expected behavior
The markdown to html conversion should take roughly the same amount of time as it does as when the above example input is modified such in one of the ways describe above (i.e. < 10ms).

Metadata

Metadata

Assignees

No one assigned

    Labels

    L0 - securityA security vulnerability within the Marked library is discovered

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions