-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: panic when passed an invalid path like \x01 #68737
Labels
GoCommand
cmd/go
Comments
seankhliao
changed the title
cmd/go: [internal/load.ImportErrorf] panic provocation
cmd/go: panic when passed an invalid path like \x01
Aug 6, 2024
I think escaping the paths every time they appear is out of scope, but I will send a CL to fix the panic. |
Change https://go.dev/cl/603475 mentions this issue: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Go version
go version go1.22.3 linux/amd64
Output of
go env
in your module/workspace:What did you do?
What did you see happen?
Function "ImportErrorf" employs an overzealous sanity check to impel cmd/go to show its path context but doesn't take into account a component which transforms non-printable characters into their quoted form.
Cf. https://cs.opensource.google/go/go/+/refs/tags/go1.22.5:src/cmd/go/internal/load/pkg.go;l=539 [2024-07-14, 2024-08-06]
What did you expect to see?
I would have expected not to be able to provoke a panic in choosing an odd pathname.
Curiously, command "go help" spits back the control character.
Earnestly, I would have expected the name to get escaped to "\x01" in both "go help" and "go [run|test|build]".
The text was updated successfully, but these errors were encountered: