-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
assorted errors in corner cases #245
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have been playing around with the new Go fuzzing support and found some bugs in goldmark v1.4.0. I am running it as:
The first four bugs seem important. The rest are more minor. Here they are:
In
a* b c d *e*
, the unusable first star appears to stop the*e*
from being recognized as emphasis."a* b c d *e*\n"
"<p>a* b c d *e*</p>\n"
"<p>a* b c d <em>e</em></p>\n"
A trailing space in an HTML tag stops it from being starting an HTML block, but it is still recognized as an inline HTML tag. I think condition 7 applies here.
"<aaa >\n"
"<p><aaa ></p>\n"
"<aaa >\n"
Internal tabs are expanded to four spaces incorrectly in pre blocks:
"\t\tx\n"
"<pre><code> x\n</code></pre>\n"
(four spaces there, not just one)"<pre><code>\tx</code></pre>\n"
NUL bytes are not replaced with U+FFFD as required:
"hello\x00world\n"
"<p>hello\x00world</p>\n"
"<p>hello\ufffdworld</p>\n"
Newlines are not preserved the same way as spaces in code spans, even though they are supposed to be converted to spaces before any other processing.
"`\n`"
"<p><code></code></p>\n"
"<p><code> </code></p>\n"
"`x\n`"
"<p><code>x</code></p>\n"
"<p><code>x </code></p>\n"
"`\nx`"
"<p><code>x</code></p>\n"
"<p><code> x</code></p>\n"
A lone # on a line without a trailing newline is not turned into an h1. (If a \n is added, this case starts working.)
"#"
"<p>#</p>\n"
"<h1></h1>\n"
A lone * on a paragraph continuation line without a trailing newline is turned into a bullet list item, incorrectly. (If a \n is added, this case starts working.)
"x\n*"
"<p>x</p>\n<ul>\n<li></li>\n</ul>\n"
"<p>x\n*</p>\n"
If a link reference definition is followed by a single or double quote, it is not recognized as a link reference definition (but it is):
"[x]: <>\n'\n"
"<p>[x]: <>\n'</p>\n"
"<p>'</p>\n"
"[x]: <>\n\"\n"
"<p>[x]: <>\n"</p>\n"
"<p>"</p>\n"
Hex character entities are not limited to 6 digits:
"A\n"
"<p>A</p>\n"
"<p>&#x0000041;</p>\n"
Not sure if this is technically a bug, but I can't figure out what rule goldmark applies for escaping a 0x01 byte. If I make it the whole URL it does not get escaped, as shown below, but if instead I use
"[x](\x01a)"
or"[x](a\x01)"
or even"[x](\x01\x01)"
then it does get escaped. Only the 0x01 byte by itself doesn't get escaped. It seems like it should get escaped all the time."[x](\x01)"
"<p><a href=\"\x01\">x</a></p>\n"
"<p><a href=\"%01\">x</a></p>\n"
A form feed is treated as a space (this appears to be a change in CommonMark 0.30).
"x \f\n"
"<p>x</p>\n"
"<p>x \f</p>\n"
Full self-contained test at https://play.golang.org/p/wHdu67atFXW.
The text was updated successfully, but these errors were encountered: