added slice bounds check

This commit is contained in:
moshee 2013-07-08 06:54:25 +00:00
parent c23099e5ee
commit 1a73bae554
2 changed files with 23 additions and 2 deletions

View File

@ -613,6 +613,27 @@ what happens here
</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>
`,
}

View File

@ -589,12 +589,12 @@ func scanLinkRef(p *parser, data []byte, i int) (linkOffset, linkEnd, titleOffse
// 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++
}