all repos — grayfriday @ 706b1e01beaf991544e2c7d5e1a019b7f18d0ed1

blackfriday fork with a few changes

Merge pull request #176 from tw4452852/index_out_of_range

fix index out of range panic in reference link
Vytautas Ĺ altenis vytas@rtfb.lt
Mon, 08 Jun 2015 11:31:14 +0300
commit

706b1e01beaf991544e2c7d5e1a019b7f18d0ed1

parent

54d3f20b5c7b0ec4fd301c800c44d805261df15d

1 files changed, 4 insertions(+), 1 deletions(-)

jump to
M markdown.gomarkdown.go

@@ -541,7 +541,7 @@ return 0

} i++ if p.flags&EXTENSION_FOOTNOTES != 0 { - if data[i] == '^' { + if i < len(data) && data[i] == '^' { // we can set it to anything here because the proper noteIds will // be assigned later during the second pass. It just has to be != 0 noteId = 1

@@ -630,6 +630,9 @@ }

linkOffset = i for i < len(data) && data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r' { i++ + } + if i == len(data) { + return } linkEnd = i if data[linkOffset] == '<' && data[linkEnd-1] == '>' {