Skip to content

[fuzz result] double underscore surrounded by asterisks prevents crossing single-underscore emphasis #747

@notriddle

Description

@notriddle

Consider this output:

$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/pulldown-cmark`
_*__*_*

_*xx*_*
<p>_<em>__</em>_*</p>
<p><em><em>xx</em></em>*</p>

It seems like the lower limit is being set on the __, because it failed to match, but the reason it didn't match is because it's % 3, so it isn't applicable to the single underscore in front.

_*__*_*

Events from pulldown-cmark:

"_*__*_*\n" -> [
  Start(Paragraph)
    Text(Borrowed("_"))
    Start(Emphasis)
      Text(Boxed("__"))
    End(Emphasis)
    Text(Boxed("_*"))
  End(Paragraph)
]

Events from pandoc:

"_*__*_*\n" -> [
  Start(Paragraph)
    Start(Emphasis)
      Start(Emphasis)
        Text(Boxed("__"))
      End(Emphasis)
    End(Emphasis)
    Text(Boxed("*"))
  End(Paragraph)
]

Events from commonmark.js:

"_*__*_*\n" -> [
  Start(Paragraph)
    Start(Emphasis)
      Start(Emphasis)
        Text(Boxed("__"))
      End(Emphasis)
    End(Emphasis)
    Text(Boxed("*"))
  End(Paragraph)
]

AST from pandoc:

Pandoc {
    meta: {},
    blocks: [
        Para(
            [
                Emph(
                    [
                        Emph(
                            [
                                Str(
                                    "__",
                                ),
                            ],
                        ),
                    ],
                ),
                Str(
                    "*",
                ),
            ],
        ),
    ],
}

thread '' panicked at fuzz_targets/pandoc.rs:112:9:
assertion failed: (left == right)

Diff < left / right > :
[
Start(
Paragraph,
),
< Text(
< Borrowed(
< "_",
< ),

Start(
Emphasis,
),
Start(
Emphasis,
),
Text(
Boxed(
"__",
),
),
End(
Emphasis,
),
End(
Emphasis,
),
Text(
Boxed(
< "_",
"
",
),
),
End(
Paragraph,
),
]

_*__-_-

Events from pulldown-cmark:

"_*__-_-\n" -> [
  Start(Paragraph)
    Text(Boxed("_*__-_-"))
  End(Paragraph)
]

Events from pandoc:

"_*__-_-\n" -> [
  Start(Paragraph)
    Start(Emphasis)
      Text(Boxed("*__-"))
    End(Emphasis)
    Text(Boxed("-"))
  End(Paragraph)
]

Events from commonmark.js:

"_*__-_-\n" -> [
  Start(Paragraph)
    Text(Boxed("_*__-_-"))
  End(Paragraph)
]

AST from pandoc:

Pandoc {
    meta: {},
    blocks: [
        Para(
            [
                Emph(
                    [
                        Str(
                            "*__-",
                        ),
                    ],
                ),
                Str(
                    "-",
                ),
            ],
        ),
    ],
}

thread '' panicked at fuzz_targets/pandoc.rs:112:9:
assertion failed: (left == right)

Diff < left / right > :
[
Start(
Paragraph,
),

Start(
Emphasis,
),
Text(
Boxed(
< "*__--",
"*__-",
),
),
End(
Emphasis,
),
Text(
Boxed(
"-",
),
),
End(
Paragraph,
),
]

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