Fix panic parsing list definition

pull/691/head
Javi Fontan 2021-09-30 11:47:56 +02:00
parent 4c9bf95126
commit 97535d7a15
No known key found for this signature in database
GPG Key ID: CC378C088E01FF94
2 changed files with 5 additions and 1 deletions

View File

@ -1360,7 +1360,7 @@ gatherlines:
if *flags&ListTypeDefinition != 0 && i < len(data)-1 {
// is the next item still a part of this list?
next := i
for next < len(data) && data[next] != '\n' {
for next < len(data)-1 && data[next] != '\n' {
next++
}
for next < len(data)-1 && data[next] == '\n' {

View File

@ -34,6 +34,10 @@ func TestDocument(t *testing.T) {
// https://github.com/russross/blackfriday/issues/173
" [",
"<p>[</p>\n",
// This should't panic.
"text\n\n:item: **text**\ntext\n",
"<dl>\n<dt>text</dt>\n</dl>\n\n<p>:item: <strong>text</strong>\ntext</p>\n",
}
doTests(t, tests)
}