Escaped closing quote at end-of-input accepted as title close
My fuzzer found an interesting behaviour. The input:
``` markdown
[f]: z "\"
[f]
```
…is interpreted by cmark 0.31.2 as a valid link definition + reference:
``` html
<p><a href="z" title="\">f</a></p>
```
This is valid HTML, but the CommonMark spec explicitly lists backslash escapes as working in link titles:
* §6.3 says: "a `"` character only if it is backslash-escaped"
* §2.4 lists backslash escapes as inert only in "code blocks, code spans, autolinks, or raw HTML."
So strictly speaking, this input should probably fail to parse?
Expected output:
``` html
<p>[f]: z ""</p>
<p>[f]</p>
```
Yes, this is ridiculous, but that's fuzzing for you.
关闭于 2026-05-01 4 条评论