mirror of
https://github.com/danog/blackfriday.git
synced 2025-01-23 05:41:27 +01:00
Revert "add an infinity-loop detection to block-level parsing"
This reverts commit 0c62e28e900533ff5d0376fac2e5b0c4894e1fa3.
This commit is contained in:
parent
17ca261449
commit
cb288d6b5d
15
block.go
15
block.go
@ -31,23 +31,8 @@ func (p *parser) block(out *bytes.Buffer, data []byte) {
|
|||||||
}
|
}
|
||||||
p.nesting++
|
p.nesting++
|
||||||
|
|
||||||
lastLen := 0
|
|
||||||
sameLenCount := 0
|
|
||||||
|
|
||||||
// parse out one block-level construct at a time
|
// parse out one block-level construct at a time
|
||||||
for len(data) > 0 {
|
for len(data) > 0 {
|
||||||
curLen := len(data)
|
|
||||||
if curLen == lastLen {
|
|
||||||
sameLenCount += 1
|
|
||||||
if sameLenCount >= 3 {
|
|
||||||
// infinity loop detection
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sameLenCount = 0
|
|
||||||
}
|
|
||||||
lastLen = curLen
|
|
||||||
|
|
||||||
// prefixed header:
|
// prefixed header:
|
||||||
//
|
//
|
||||||
// # Header 1
|
// # Header 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user