]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.23] unique: don't retain uncloned input as key
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 4 Sep 2024 16:46:33 +0000 (16:46 +0000)
committerGopher Robot <gobot@golang.org>
Wed, 11 Sep 2024 18:11:20 +0000 (18:11 +0000)
commita74951c5af5498db5d4be0c14dcaa45fb452e23a
treebf06e2c8041f003fb6744c70e9c248101c53fdbb
parente6598e7baafa5650f82b9575c053a52c2601bf8f
[release-branch.go1.23] unique: don't retain uncloned input as key

Currently the unique package tries to clone strings that get stored in
its internal map to avoid retaining large strings.

However, this falls over entirely due to the fact that the original
string is *still* stored in the map as a key. Whoops. Fix this by
storing the cloned value in the map instead.

This change also adds a test which fails without this change.

For #69370.
Fixes #69383.

Change-Id: I1a6bb68ed79b869ea12ab6be061a5ae4b4377ddb
Reviewed-on: https://go-review.googlesource.com/c/go/+/610738
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit 21ac23a96f204dfb558a8d3071380c1d105a93ba)
Reviewed-on: https://go-review.googlesource.com/c/go/+/612295
Auto-Submit: Tim King <taking@google.com>
src/unique/handle.go
src/unique/handle_test.go