Skip to content

[fuzz result]: link reference destination isn't fully checked for balanced parens #737

@notriddle

Description

@notriddle

Link reference definitions are defined as:

A link reference definition consists of a link label, optionally preceded by up to three spaces of indentation, followed by a colon (:), optional spaces or tabs (including up to one line ending), a link destination, optional spaces or tabs (including up to one line ending), and an optional link title, which if it is present must be separated from the link destination by spaces or tabs. No further character may occur.

And it defines a link destination as:

a nonempty sequence of characters that does not start with <, does not include ASCII control characters or space character, and includes parentheses only if (a) they are backslash-escaped or (b) they are part of a balanced pair of unescaped parentheses. (Implementations may impose limits on parentheses nesting to avoid performance issues, but at least three levels of nesting should be supported.)

Events from pulldown-cmark:

"[~]:(\n" -> [
]

Events from pandoc:

"[~]:(\n" -> [
  Start(Paragraph)
    Text(Boxed("[~]:("))
  End(Paragraph)
]

Events from commonmark.js:

"[~]:(\n" -> [
  Start(Paragraph)
    Text(Boxed("[~]:("))
  End(Paragraph)
]

AST from pandoc

Pandoc {
    meta: {},
    blocks: [
        Para(
            [
                Str(
                    "[~]:(",
                ),
            ],
        ),
    ],
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions