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

cmd/link: panic with empty or short -B argument #14636

Closed
rhysh opened this issue Mar 4, 2016 · 1 comment

Comments

Projects
None yet
3 participants
@rhysh
Copy link
Contributor

commented Mar 4, 2016

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

go version go1.6 darwin/amd64

What did you do?
What did you see instead?

$ go tool link -B ''
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x236380, 0x82040e0f0)
    /usr/local/go/src/runtime/panic.go:464 +0x3e6
cmd/link/internal/ld.addbuildinfo(0x7fff5fbffb50, 0x0)
    /usr/local/go/src/cmd/link/internal/ld/elf.go:1205 +0x98d
cmd/internal/obj.fn1.Set(0x2dc1f0, 0x7fff5fbffb50, 0x0, 0x0, 0x0)
    /usr/local/go/src/cmd/internal/obj/flag.go:116 +0x3c
flag.(*FlagSet).parseOne(0x82047c000, 0x8204a0b80, 0x0, 0x0)
    /usr/local/go/src/flag/flag.go:881 +0xdd9
flag.(*FlagSet).Parse(0x82047c000, 0x8204a0b90, 0x2, 0x3, 0x0, 0x0)
    /usr/local/go/src/flag/flag.go:900 +0x6e
flag.Parse()
    /usr/local/go/src/flag/flag.go:928 +0x6f
cmd/internal/obj.Flagparse(0x2dc2a0)
    /usr/local/go/src/cmd/internal/obj/flag.go:49 +0x2d
cmd/link/internal/ld.Ldmain()
    /usr/local/go/src/cmd/link/internal/ld/pobj.go:149 +0x14cc
cmd/link/internal/amd64.Main()
    /usr/local/go/src/cmd/link/internal/amd64/obj.go:44 +0x19
main.main()
    /usr/local/go/src/cmd/link/main.go:27 +0x36f

What did you expect to see?

I'd expect no panic, and an error message of -B argument must start with 0x:.

@minux minux added this to the Go1.7 milestone Mar 4, 2016

@gopherbot

This comment has been minimized.

Copy link

commented Mar 4, 2016

CL https://golang.org/cl/20211 mentions this issue.

@gopherbot gopherbot closed this in 3375974 Mar 4, 2016

@golang golang locked and limited conversation to collaborators Mar 13, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.