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/buildid: crashes trying to write buildid in binary built by Go 1.5 #50809

Closed
stevemk14ebr opened this issue Jan 25, 2022 · 2 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@stevemk14ebr
Copy link
Contributor

stevemk14ebr commented Jan 25, 2022

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

1.17.2 linux/amd64

$ go version
1.17.2 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

linux

go env Output
$ go env

What did you do?

run go tool buildid -w <filepath> on a go 1.5 binary and the following error will occur:

panic: runtime error: slice bounds out of range [:-1]

goroutine 1 [running]:
main.main()
        /usr/local/go/src/cmd/buildid/buildid.go:56 +0x60d

The line:

newID := id[:strings.LastIndex(id, "/")] + "/" + buildid.HashToString(hash)

This is because in go 1.5 the contentID did not exist, so the slash seperator is not present, causing issues. The buildid tool doesn't consider legacy buildID/actionID/contentID layouts.

What did you expect to see?

The buildID / contentID to be written

What did you see instead?

crash

@ianlancetaylor ianlancetaylor changed the title affected/package: go tool buildid cmd/buildid: crashes trying to write buildid in binary built by Go 1.5 Jan 25, 2022
@ianlancetaylor
Copy link
Contributor

Also fails with Go 1.6 through Go 1.9. Go 1.10 and later seem to work.

Those older versions of Go are not supported. If someone wants to contribute a fix that would be fine but I don't think we are going to actively work on this.

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 25, 2022
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Jan 25, 2022
@gopherbot
Copy link

Change https://go.dev/cl/409535 mentions this issue: cmd/buildid: reject rewriting legacy buildids

@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jun 6, 2022
@dmitshur dmitshur modified the milestones: Unplanned, Go1.19 Jun 6, 2022
@golang golang locked and limited conversation to collaborators Jun 6, 2023
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.
Projects
None yet
4 participants