added slice bounds check
moshee moshee@displaynone.us
Mon, 08 Jul 2013 06:54:25 +0000
2 files changed,
23 insertions(+),
2 deletions(-)
M
inline_test.go
→
inline_test.go
@@ -614,6 +614,27 @@ </li>
</ol> </div> `, + + `This is a footnote[^1]^[and this is an inline footnote] + +[^1]: the footnote text. + + may be multiple paragraphs. +`, + `<p>This is a footnote<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup><sup class="footnote-ref" id="fnref:and-this-is-an-i"><a rel="footnote" href="#fn:and-this-is-an-i">2</a></sup></p> +<div class="footnotes"> + +<hr /> + +<ol> +<li id="fn:1"><p>the footnote text.</p> + +<p>may be multiple paragraphs.</p> +</li> +<li id="fn:and-this-is-an-i">and this is an inline footnote</li> +</ol> +</div> +`, } doTestsInlineParam(t, tests, EXTENSION_FOOTNOTES, 0)
M
markdown.go
→
markdown.go
@@ -589,12 +589,12 @@ // blockEnd is the end of the section in the input buffer, and contents is the
// extracted text that was shifted over one tab. It will need to be rendered at // the end of the document. func scanFootnote(p *parser, data []byte, i, indentSize int) (blockStart, blockEnd int, contents []byte, hasBlock bool) { - if i == 0 { + if i == 0 || len(data) == 0 { return } // skip leading whitespace on first line - for data[i] == ' ' { + for i < len(data) && data[i] == ' ' { i++ }