]> Cypherpunks repositories - gostls13.git/commit
cmd/go: prevent infinite loop in QueryPackage()
authorAnton Gyllenberg <anton@iki.fi>
Tue, 2 Oct 2018 22:47:28 +0000 (22:47 +0000)
committerBryan C. Mills <bcmills@google.com>
Wed, 3 Oct 2018 13:57:04 +0000 (13:57 +0000)
commit54f5a6674a9463fecb8656c9ffc6d80374c5868d
tree763b43ba56b0bd9f579d44d61b03dfb6116f71ec
parenta3a69afff85c94be8b6419b03efd5dc14f2425f9
cmd/go: prevent infinite loop in QueryPackage()

p = path.Dir(p) converges to either "." or "/". The current
implementation of modload.QueryPackage() has a loop that
terminates only on ".", not "/". This leads to the go command
hanging in an infinite loop if the user manages to supply
a file path starting with "/" as package path.

An example of the issue is if the user (incorrectly) attempts
to use an absolute directory path in an import statement within
a module (import "/home/bob/myproj") and then runs go list.

Fixes #27558

Change-Id: Iaa6a4f7b05eba30609373636e50224ae2e7d6158
GitHub-Last-Rev: 3a70d3a4277395c2dd8bb50f61b1ac3e44caee28
GitHub-Pull-Request: golang/go#27976
Reviewed-on: https://go-review.googlesource.com/c/139098
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go/internal/modload/query.go