Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slice bounds out of range on Windows #36

Closed
bep opened this issue Nov 25, 2019 · 6 comments
Closed

slice bounds out of range on Windows #36

bep opened this issue Nov 25, 2019 · 6 comments
Labels
bug Something isn't working

Comments

@bep
Copy link

bep commented Nov 25, 2019

bep added a commit to gohugoio/hugo that referenced this issue Nov 25, 2019
@yuin
Copy link
Owner

yuin commented Nov 25, 2019

@bep I can not reproduce this. Could you provide stacktrace?

@yuin
Copy link
Owner

yuin commented Nov 25, 2019

I've tested following steps on Windows.

$ wget https://raw.githubusercontent.com/gohugoio/hugo/master/hugolib/testdata/what-is-markdown.md
	markdown := New(WithRendererOptions(
		html.WithXHTML(),
	))
	source, _ := ioutil.ReadFile("what-is-markdown.md")
	var b bytes.Buffer
	err := markdown.Convert(source, &b)
	if err != nil {
		t.Error(err.Error())
	}
	println(b.String())

And did not get crash.

@bep
Copy link
Author

bep commented Nov 25, 2019

I'm guessing that it's one of the options/extensions that Hugo uses.

See:

gohugoio/hugo#6537

Which should eventually fail on WIndows See the Travis build log for stack trace.

I'm not normally using Windows (I have a VM if I ... have to).

@bep
Copy link
Author

bep commented Nov 26, 2019

Stack trace:

goroutine 5810 [running]:
runtime/debug.Stack(0x16e2f80, 0x1f58820, 0xc000246660)
	C:/Users/travis/.gimme/versions/go1.13.1.windows.amd64/src/runtime/debug/stack.go:24 +0xa4
github.com/gohugoio/hugo/markup/goldmark.(*goldmarkConverter).Convert.func1(0xc000071680, 0xc007392000, 0x33d8d, 0x3909b, 0xc007390301, 0xc0073903f8)
	C:/Users/travis/src/hugo/markup/goldmark/convert.go:162 +0x1f9
panic(0x13b11a0, 0xc00091e700)
	C:/Users/travis/.gimme/versions/go1.13.1.windows.amd64/src/runtime/panic.go:679 +0x1c0
github.com/yuin/goldmark/text.(*Segment).TrimRightSpace(0xc00738ffd0, 0xc007392000, 0x33d8d, 0x3909b, 0x0, 0x16f3920, 0xc000668b60)
	C:/Users/travis/gopath/pkg/mod/github.com/yuin/[email protected]/text/segment.go:76 +0xe3
github.com/yuin/goldmark/parser.(*parser).parseBlock(0xc000653500, 0x16f39e0, 0xc000e45740, 0x1708060, 0xc007402880, 0x16f3920, 0xc000668b60)
	C:/Users/travis/gopath/pkg/mod/github.com/yuin/[email protected]/parser/parser.go:1168 +0x6fa
github.com/yuin/goldmark/parser.(*parser).Parse.func2(0x1708060, 0xc007402880)
	C:/Users/travis/gopath/pkg/mod/github.com/yuin/[email protected]/parser/parser.go:822 +0x69
github.com/yuin/goldmark/parser.(*parser).walkBlock(0xc000653500, 0x1708060, 0xc007402880, 0xc007390238)
	C:/Users/travis/gopath/pkg/mod/github.com/yuin/[email protected]/parser/parser.go:1072 +0xb7
github.com/yuin/goldmark/parser.(*parser).walkBlock(0xc000653500, 0x1707f40, 0xc0073fd680, 0xc007390238)
	C:/Users/travis/gopath/pkg/mod/github.com/yuin/[email protected]/parser/parser.go:1070 +0x74
github.com/yuin/goldmark/parser.(*parser).walkBlock(0xc000653500, 0x1707e20, 0xc0073fd5f0, 0xc007390238)
	C:/Users/travis/gopath/pkg/mod/github.com/yuin/[email protected]/parser/parser.go:1070 +0x74
github.com/yuin/goldmark/parser.(*parser).walkBlock(0xc000653500, 0x1707640, 0xc00737f600, 0xc007390238)
	C:/Users/travis/gopath/pkg/mod/github.com/yuin/[email protected]/parser/parser.go:1070 +0x74
github.com/yuin/goldmark/parser.(*parser).Parse(0xc000653500, 0x16f34a0, 0xc000668bd0, 0xc0010761c8, 0x1, 0x1, 0x3fde8, 0x0)
	C:/Users/travis/gopath/pkg/mod/github.com/yuin/[email protected]/parser/parser.go:821 +0x25d
github.com/gohugoio/hugo/markup/goldmark.(*goldmarkConverter).Convert(0xc000071680, 0xc007392000, 0x33d8d, 0x3909b, 0xef5801, 0x16af0a0, 0xc007383ef0, 0x0, 0x0)
	C:/Users/travis/src/hugo/markup/goldmark/convert.go:175 +0x39a
github.com/gohugoio/hugo/hugolib.(*pageContentOutput).renderContent(0xc000d77a40, 0xc007392000, 0x33d8d, 0x3909b, 0xc000947e60, 0xc000da9040, 0x0, 0x16bb2e0)
	C:/Users/travis/src/hugo/hugolib/page__per_output.go:333 +0x7b
github.com/gohugoio/hugo/hugolib.newPageContentOutput.func1.1(0x0, 0x0)
	C:/Users/travis/src/hugo/hugolib/page__per_output.go:102 +0xa85
github.com/gohugoio/hugo/hugolib.newPageContentOutput.func1.3(0xc0073907a8, 0x40fef2, 0xc007390818, 0xc0006d6798)
	C:/Users/travis/src/hugo/hugolib/page__per_output.go:188 +0x2d

@yuin yuin closed this as completed in 6c55ba5 Nov 26, 2019
@yuin
Copy link
Owner

yuin commented Nov 26, 2019

@bep I could not found what hugo test wrong is, but I saw same error in fuzzing.
I've fixed the error found in fuzzing, so this issue is probably resolved.
Could you confirm this?

@bep
Copy link
Author

bep commented Nov 26, 2019

I will bump the Goldmark version in that PR and close this if that succeeds.

bep added a commit to bep/hugo that referenced this issue Nov 26, 2019
bep added a commit to gohugoio/hugo that referenced this issue Nov 26, 2019
@yuin yuin added the bug Something isn't working label Nov 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants