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/compile: max/min builtin broken when used with string(byte) conversions [1.21 backport] #64567

Closed
gopherbot opened this issue Dec 5, 2023 · 3 comments
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime.
Milestone

Comments

@gopherbot
Copy link

@mdempsky requested issue #64565 to be considered for backport to the next 1.21 minor release.

This appears to be an escape analysis issue.

@gopherbot Please backport to Go 1.21. This is a silent miscompilation / memory corruption issue.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Dec 5, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Dec 5, 2023
@gopherbot gopherbot added this to the Go1.21.6 milestone Dec 5, 2023
@gopherbot
Copy link
Author

Change https://go.dev/cl/547757 mentions this issue: [release-branch.go1.21] cmd/compile: fix escape analysis of string min/max

@cagedmantis
Copy link
Contributor

Approved. It's a serious issue without a workaround.

@cagedmantis cagedmantis added the CherryPickApproved Used during the release process for point releases label Dec 6, 2023
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Dec 6, 2023
gopherbot pushed a commit that referenced this issue Dec 6, 2023
…n/max

When I was plumbing min/max support through the compiler, I was
thinking mostly about numeric argument types. As a result, I forgot
that escape analysis would need to be aware that min/max can operate
on string values, which contain pointers.

Updates #64565.
Fixes #64567.

Change-Id: I36127ce5a2da942401910fa0f9de922726c9f94d
Reviewed-on: https://go-review.googlesource.com/c/go/+/547715
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit 34416d7)
Reviewed-on: https://go-review.googlesource.com/c/go/+/547757
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
@gopherbot
Copy link
Author

Closed by merging 9f8b3ac to release-branch.go1.21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime.
Projects
None yet
Development

No branches or pull requests

2 participants