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

x/tools/present: runtime error: index out of range #17561

Closed
i4ki opened this issue Oct 24, 2016 · 1 comment
Closed

x/tools/present: runtime error: index out of range #17561

i4ki opened this issue Oct 24, 2016 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@i4ki
Copy link

i4ki commented Oct 24, 2016

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.7 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/i4k/.gvm/pkgsets/go1.7/global"
GORACE=""
GOROOT="/home/i4k/.gvm/gos/go1.7"
GOTOOLDIR="/home/i4k/.gvm/gos/go1.7/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build934553730=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

I ran:

present -notes -play -orighost localhost

With an invalid .link/.iframe/.image/.background line like below:

.link

What did you expect to see?

An error in the browser, like below:
nash.slide:290: syntax error for .link invocation

Others invocations like .play/.code works as expected.

I had to dig into the stack trace to figure out the problem was with an invalid link to then find the wrong syntax in the presentation.

What did you see instead?

The server closes the connection without sending any data (ERR_EMPTY_RESPONSE on chrome).

And the server panics with:

λ> present -notes -play -orighost localhost
2016/10/24 03:11:18 Open your web browser and visit http://localhost:3999
2016/10/24 03:11:18 Notes are enabled, press 'N' from the browser to display them.
2016/10/24 03:11:24 http: panic serving 127.0.0.1:43080: runtime error: index out of range
goroutine 40 [running]:
net/http.(*conn).serve.func1(0xc420132f80)
    /home/i4k/.gvm/gos/go1.7/src/net/http/server.go:1491 +0x13d
panic(0x77d3e0, 0xc420014130)
    /home/i4k/.gvm/gos/go1.7/src/runtime/panic.go:458 +0x243
golang.org/x/tools/present.parseLink(0xc42012e348, 0xc420127ac0, 0xa, 0x122, 0xc420127d28, 0x5, 0x3, 0x8, 0x15d, 0x0)
    /home/i4k/.gvm/pkgsets/go1.7/global/src/golang.org/x/tools/present/link.go:27 +0x305
golang.org/x/tools/present.parseSections(0xc42012e348, 0xc420127ac0, 0xa, 0xc4201fc160, 0xc420249a08, 0x0, 0x0, 0xc420131960, 0xc42002a800, 0x7f047221f960, ...)
    /home/i4k/.gvm/pkgsets/go1.7/global/src/golang.org/x/tools/present/parse.go:373 +0xf65
golang.org/x/tools/present.(*Context).Parse(0xc42012e348, 0x9fdd00, 0xc42012e340, 0xc420127ac0, 0xa, 0x0, 0xc420034ae8, 0x401f53, 0xc420034ae0)
    /home/i4k/.gvm/pkgsets/go1.7/global/src/golang.org/x/tools/present/parse.go:278 +0x3b8
golang.org/x/tools/present.Parse(0x9fdd00, 0xc42012e340, 0xc420127ac0, 0xa, 0x0, 0xd, 0x9fdb40, 0xa)
    /home/i4k/.gvm/pkgsets/go1.7/global/src/golang.org/x/tools/present/parse.go:288 +0x8f
main.parse(0xc420127ac0, 0xa, 0x0, 0x0, 0x0, 0x0)
    /home/i4k/.gvm/pkgsets/go1.7/global/src/golang.org/x/tools/cmd/present/dir.go:120 +0xee
main.renderDoc(0x9fdb40, 0xc420139860, 0xc420127ac0, 0xa, 0xc420139860, 0xc420127a40)
    /home/i4k/.gvm/pkgsets/go1.7/global/src/golang.org/x/tools/cmd/present/dir.go:102 +0x42
main.dirHandler(0xa02b80, 0xc420139860, 0xc4201f4000)
    /home/i4k/.gvm/pkgsets/go1.7/global/src/golang.org/x/tools/cmd/present/dir.go:33 +0x133
net/http.HandlerFunc.ServeHTTP(0x88ad28, 0xa02b80, 0xc420139860, 0xc4201f4000)
    /home/i4k/.gvm/gos/go1.7/src/net/http/server.go:1731 +0x44
net/http.(*ServeMux).ServeHTTP(0xa23c60, 0xa02b80, 0xc420139860, 0xc4201f4000)
    /home/i4k/.gvm/gos/go1.7/src/net/http/server.go:2027 +0x7f
net/http.serverHandler.ServeHTTP(0xc420132f00, 0xa02b80, 0xc420139860, 0xc4201f4000)
    /home/i4k/.gvm/gos/go1.7/src/net/http/server.go:2207 +0x7d
net/http.(*conn).serve(0xc420132f80, 0xa03300, 0xc42018eec0)
    /home/i4k/.gvm/gos/go1.7/src/net/http/server.go:1584 +0x4b7
created by net/http.(*Server).Serve
    /home/i4k/.gvm/gos/go1.7/src/net/http/server.go:2298 +0x44d
Got 2188 bytes
Err: runtime error: index out of range
2016/10/24 03:11:24 http: panic serving 127.0.0.1:43084: runtime error: index out of range
goroutine 41 [running]:
net/http.(*conn).serve.func1(0xc420133f80)
    /home/i4k/.gvm/gos/go1.7/src/net/http/server.go:1491 +0x13d
panic(0x77d3e0, 0xc420014130)
    /home/i4k/.gvm/gos/go1.7/src/runtime/panic.go:458 +0x243
golang.org/x/tools/present.parseLink(0xc420028168, 0xc420014b40, 0xa, 0x122, 0xc420014da8, 0x5, 0x3, 0x8, 0x15d, 0x0)
    /home/i4k/.gvm/pkgsets/go1.7/global/src/golang.org/x/tools/present/link.go:27 +0x305
golang.org/x/tools/present.parseSections(0xc420028168, 0xc420014b40, 0xa, 0xc420013460, 0xc420245a08, 0x0, 0x0, 0xc420012c60, 0xc42002a800, 0x7f047221f000, ...)
    /home/i4k/.gvm/pkgsets/go1.7/global/src/golang.org/x/tools/present/parse.go:373 +0xf65
golang.org/x/tools/present.(*Context).Parse(0xc420028168, 0x9fdd00, 0xc420028160, 0xc420014b40, 0xa, 0x0, 0xc420034ae8, 0x401f53, 0xc420034ae0)
    /home/i4k/.gvm/pkgsets/go1.7/global/src/golang.org/x/tools/present/parse.go:278 +0x3b8
golang.org/x/tools/present.Parse(0x9fdd00, 0xc420028160, 0xc420014b40, 0xa, 0x0, 0xd, 0x9fdb40, 0xa)
    /home/i4k/.gvm/pkgsets/go1.7/global/src/golang.org/x/tools/present/parse.go:288 +0x8f
main.parse(0xc420014b40, 0xa, 0x0, 0x0, 0x0, 0x0)
    /home/i4k/.gvm/pkgsets/go1.7/global/src/golang.org/x/tools/cmd/present/dir.go:120 +0xee
main.renderDoc(0x9fdb40, 0xc42031a000, 0xc420014b40, 0xa, 0xc42031a000, 0xc420014ac0)
    /home/i4k/.gvm/pkgsets/go1.7/global/src/golang.org/x/tools/cmd/present/dir.go:102 +0x42
main.dirHandler(0xa02b80, 0xc42031a000, 0xc4201f40f0)
    /home/i4k/.gvm/pkgsets/go1.7/global/src/golang.org/x/tools/cmd/present/dir.go:33 +0x133
net/http.HandlerFunc.ServeHTTP(0x88ad28, 0xa02b80, 0xc42031a000, 0xc4201f40f0)
    /home/i4k/.gvm/gos/go1.7/src/net/http/server.go:1731 +0x44
net/http.(*ServeMux).ServeHTTP(0xa23c60, 0xa02b80, 0xc42031a000, 0xc4201f40f0)
    /home/i4k/.gvm/gos/go1.7/src/net/http/server.go:2027 +0x7f
net/http.serverHandler.ServeHTTP(0xc420132f00, 0xa02b80, 0xc42031a000, 0xc4201f40f0)
    /home/i4k/.gvm/gos/go1.7/src/net/http/server.go:2207 +0x7d
net/http.(*conn).serve(0xc420133f80, 0xa03300, 0xc420286b00)
    /home/i4k/.gvm/gos/go1.7/src/net/http/server.go:1584 +0x4b7
created by net/http.(*Server).Serve
    /home/i4k/.gvm/gos/go1.7/src/net/http/server.go:2298 +0x44d
@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 24, 2016
@quentinmit quentinmit added this to the Unreleased milestone Oct 24, 2016
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 12, 2019
@dmitshur
Copy link
Contributor

This has been fixed via CL 44690 and CL 45110.

@golang golang locked and limited conversation to collaborators Oct 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants