Skip to content

Commit e0fc813

Browse files
committed
fix infinite tests
1 parent 8c57d3e commit e0fc813

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

fuzz_crashes_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ func TestCrash1(t *testing.T) {
2828
}
2929
}
3030

31-
// TODO: this enters infinite loop
32-
func NoTestInfinite1(t *testing.T) {
31+
func TestInfinite1(t *testing.T) {
3332
test := "[[[[[[\n\t: ]]]]]]\n\n: " + "\n\n:(()"
3433
c := make(chan bool, 1)
3534
go func() {
@@ -77,7 +76,7 @@ main.main()
7776
go.fuzz.main/main.go:10 +0x2d fp=0xc42049df80 sp=0xc42049df68 pc=0x1118dad
7877
runtime.main()
7978
*/
80-
func NoTestInfinite2(t *testing.T) {
79+
func TestInfinite2(t *testing.T) {
8180
test := ":\x00\x00\x00\x01V\n>* \x00\x80e\n\t* \n\n:\t"
8281

8382
c := make(chan bool, 1)

parser/block.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ func (p *Parser) block(data []byte) {
244244

245245
// anything else must look like a normal paragraph
246246
// note: this finds underlined headings, too
247-
data = data[p.paragraph(data):]
247+
idx := p.paragraph(data)
248+
data = data[idx:]
248249
}
249250

250251
p.nesting--
@@ -1479,7 +1480,8 @@ func (p *Parser) paragraph(data []byte) int {
14791480
// did this blank line followed by a definition list item?
14801481
if p.extensions&DefinitionLists != 0 {
14811482
if i < len(data)-1 && data[i+1] == ':' {
1482-
return p.list(data[prev:], ast.ListTypeDefinition)
1483+
listLen := p.list(data[prev:], ast.ListTypeDefinition)
1484+
return prev + listLen
14831485
}
14841486
}
14851487

0 commit comments

Comments
 (0)