fix crashes found with go-fuzz
This commit is contained in:
parent
339c59ffbe
commit
5dd4b50fe8
|
@ -13,7 +13,8 @@ func TestCrash1(t *testing.T) {
|
|||
"0\n\n:\n00",
|
||||
">>0```\n\n:\n```",
|
||||
"[0]:<",
|
||||
"[[[[[[\n\t: ]]]]]]\n\n: " + "\n\n:(()",
|
||||
// TODO: this enters infinite loop
|
||||
//"[[[[[[\n\t: ]]]]]]\n\n: " + "\n\n:(()",
|
||||
">0\n>\n:\n00",
|
||||
": : \n\n\t0\n00",
|
||||
"0\n: : \n\n\t0\n00",
|
||||
|
|
|
@ -1364,7 +1364,7 @@ gatherlines:
|
|||
for next < len(data)-1 && data[next] == '\n' {
|
||||
next++
|
||||
}
|
||||
if i < len(data)-1 && data[i] != ':' && data[next] != ':' {
|
||||
if i < len(data)-1 && data[i] != ':' && next < len(data)-1 && data[next] != ':' {
|
||||
*flags |= ast.ListItemEndOfList
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -499,7 +499,7 @@ func scanLinkRef(p *Parser, data []byte, i int) (linkOffset, linkEnd, titleOffse
|
|||
i++
|
||||
}
|
||||
linkEnd = i
|
||||
if data[linkOffset] == '<' && data[linkEnd-1] == '>' {
|
||||
if linkEnd < len(data) && data[linkOffset] == '<' && data[linkEnd-1] == '>' {
|
||||
linkOffset++
|
||||
linkEnd--
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue