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/go: disallowVendorVisibility crashes on invalid import path that contains "vendor" #11414

Closed
sbunce opened this issue Jun 26, 2015 · 1 comment
Milestone

Comments

@sbunce
Copy link

sbunce commented Jun 26, 2015

I'm using the new GO15VENDOREXPERIMENT support. I tried to compile some code that was trying to import an old vendor directory I had removed.

I stuck some print statements right above where it panic'd. Right above this line here.
https://github.com/golang/go/blob/master/src/cmd/go/pkg.go#L555

parent := p.Dir[:i+len(p.Dir)-len(p.ImportPath)]

These are the values of the variables.
p.ImportPath = "local/vendor/protobuf/proto"
p.Dir = ""
i = 5

It's trying to do p.Dir[:-22].

panic: runtime error: slice bounds out of range

goroutine 1 [running]:
main.disallowVendorVisibility(0xc82010f980, 0x21, 0xc8204c4400, 0xc82014f908, 0x2)
    /home/sbunce/src/go1.5/src/cmd/go/pkg.go:563 +0x84a
main.disallowVendor(0xc82010f980, 0x21, 0xc8201d2441, 0x1b, 0xc8204c4400, 0xc82014f908, 0x1a)
    /home/sbunce/src/go1.5/src/cmd/go/pkg.go:512 +0x8a
main.loadImport(0xc8201d2441, 0x1b, 0xc82010f980, 0x21, 0xc8204c4000, 0xc82014f908, 0xc82010fef0, 0x1, 0x1, 0x0)
    /home/sbunce/src/go1.5/src/cmd/go/pkg.go:329 +0xf20
main.(*Package).load(0xc8204c4000, 0xc82014f908, 0xc820221800, 0x0, 0x0, 0x4)
    /home/sbunce/src/go1.5/src/cmd/go/pkg.go:845 +0x4219
main.loadImport(0xc8200f0851, 0xd, 0xc820111be0, 0x1e, 0xc820549000, 0xc82014f908, 0xc8201e6300, 0x3, 0x3, 0x0)
    /home/sbunce/src/go1.5/src/cmd/go/pkg.go:319 +0xd45
main.(*Package).load(0xc820549000, 0xc82014f908, 0xc8202c5500, 0x0, 0x0, 0x4)
    /home/sbunce/src/go1.5/src/cmd/go/pkg.go:845 +0x4219
main.loadImport(0xc8201768d4, 0xa, 0xc82000a094, 0x21, 0x0, 0xc82014f908, 0x0, 0x0, 0x0, 0x0)
    /home/sbunce/src/go1.5/src/cmd/go/pkg.go:319 +0xd45
main.loadPackage(0xc8201768d4, 0xa, 0xc82014f908, 0x0)
    /home/sbunce/src/go1.5/src/cmd/go/pkg.go:1512 +0x13a4
main.packagesAndErrors(0xc820496a80, 0x34, 0x38, 0x0, 0x0, 0x0)
    /home/sbunce/src/go1.5/src/cmd/go/pkg.go:1551 +0x3b4
main.packages(0xc82000a320, 0x1, 0x1, 0x0, 0x0, 0x0)
    /home/sbunce/src/go1.5/src/cmd/go/pkg.go:1525 +0x8a
main.runGenerate(0xbb5be0, 0xc82000a320, 0x1, 0x1)
    /home/sbunce/src/go1.5/src/cmd/go/generate.go:147 +0x1a5
main.main()
    /home/sbunce/src/go1.5/src/cmd/go/main.go:177 +0x74d
@sbunce sbunce changed the title disallowVendorVisibility crashes on invalid import path that contains "vendor" cmd/go: disallowVendorVisibility crashes on invalid import path that contains "vendor" Jun 26, 2015
@josharian josharian added this to the Go1.5 milestone Jun 26, 2015
@gopherbot
Copy link

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

@rsc rsc closed this as completed in 06b2802 Jul 7, 2015
@golang golang locked and limited conversation to collaborators Jul 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants